This has nothing to do with my problem, I just illustrating that I'm a newcomer to PHP, not coding
So the problem script is one I'm making for a friend who is constructing a Member Awards for another Forum. Currently, the script only asks you to type in the name of your vote into a text field. We both agree that a Select Box would be more appropriate. So, since neither of us realy want to write a Select Box with the usernames of every member in HTML, I decided that creating an array of the usernames and using a For loop to add them to the box would be the best way.
It's a VERY simple script, but I can't get it to output the array.
If you ask it to print out any name in the array, it will have no problems, but in a For loop, they just don't exist.
I thought it might just be that the array is too long, so I put in a While loop to stop the prossessing untill the array had been populated, but that didn't work.
Here's the script:
Code: Select all
<?
$User=array("e;User1"e;,"e;User2"e;,"e;User3"e;);
function select($name, $size){
print "e;<SELECT NAME='"e;.$name."e;' SIZE='"e;.$size."e;'>\n"e;;
for ($a=0; $a<count($User); $a++){
print "e;<OPTION VALUE='"e;.$Userї$a]."e;'>"e;.$Userї$a]."e;</OPTION>\n"e;;
}
print "e;</SELECT>"e;;
}
select(sel1, 5);
?>I realy am at a loss here, if anyone can spot where I'm going wrong, I'd be most appreiciative.
For the record, I've tried replacing "$a<count($User)" with "$a<3". No joy...