Hi all,
I'm trying to make a dynamically generated form sticky - successful in every way, except for the textfields generated with the following code:
PHP Code:
$el_num = $_POST['el_menu']; $i = 1; $x = 5; while($i <= $el_num){ echo "External link # $i<br><input type=\"text\" name=\"el_name_$i\" value=\""; if(isset($_POST['el_name_{$i}'])){ echo $_POST['el_name_{$i}'];}else{ echo "Label"; } echo "\" onFocus=\"MM_setTextOfTextfield('el_name_{$i}','','')\"> Example: Sponsor $i <input type\"text\" name=\"el_url_$i\" value=\""; if(isset($_POST['el_url_{$i}'])){ echo $_POST['el_url_{$i}'];}else{ echo "URL"; } echo "\" onFocus=\"MM_setTextOfTextfield('el_url_{$i}','','')\"><a href=\"help.php?context=el_urls\" target=\"_blank\"><img src=\"images/help.gif\" border=\"0\"></a><br>"; $i++; } } }
The test always returns false and displays the defualt text for the textfields instead of the posted value. If I echo out "el_name_2" elsewhere i the page, it's fine. But when I try to do it using the "$i" variable, it doesn't work - even though "$i" is storing the numbers correctly. I am aware that variables can only be parsed when they're in double quotes, but can't get my head around this today for some reason!!
Can anyone tell me what I need to do?
Thanks in advance!
|