Hi Friends,
I want to get the value into '$txt' from an array of hidden fields named 'hd' . I tried the following code...it's not working
for($i=0;$<10;$i++)
{
<input type ="hidden" name="hd $i" value ="$i">
}
$txt = array();
for($i=0;$<10;$i++)
{
$txt[$i] = $_GET['hd'.$i];
echo $txt[$i]."<br>";
}
Any help will be greatly appreciated
Help with drop down list
Moderator: General Moderators
Re: Help with drop down list
Mmm, first of all you need to give the hidden fields a proper name, secondly submit the data.
Say you have submitted the fields and returned an array:
A better way might be to:
As you have already an array with the same values.
Say you have submitted the fields and returned an array:
Code: Select all
$hd = $_POST['hd'];
for($i=0;$i<count($hd);$i++)
{
$txt[] = $hd[$i];
}Code: Select all
$hd = $_GET['hd'];
for($i=0;$i<count($hd);$i++)
{
echo $hd[$i]."<br />\n";
}Re: Help with drop down list
Code: Select all
<input type ="hidden" name="hd[]" value ="$i">- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: Help with drop down list
What do you want to do, loop the array values or simply copy the array itself to $txt?
-
littlecoder
- Forum Commoner
- Posts: 26
- Joined: Fri Oct 17, 2008 4:36 am
Re: Help with drop down list
Hi ,
It was a problem with my AJAX . Managed to get through it .
Thank you for your suggestions
It was a problem with my AJAX . Managed to get through it .
Thank you for your suggestions