PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Wolf_22
Forum Contributor
Posts: 159 Joined: Fri Dec 26, 2008 9:43 pm
Post
by Wolf_22 » Sat Jun 27, 2009 11:13 am
I have a form that basically has the following in it:
Code: Select all
echo "\t\t\t<input type=\"radio\" name=\"sols[0]\" value=\"" . $ops[$i] . "\"> " . $ops[$i] . "<br />\n";
In the above, I'm curious as to what the "name" is. To me, it looks like an array, but don't all arrays require the money sign ($) to be placed in front of them?
juma929
Forum Commoner
Posts: 72 Joined: Wed Jun 17, 2009 9:41 am
Post
by juma929 » Sat Jun 27, 2009 12:01 pm
Hello,
That is a HTML form array so you can access all elements using arrays in PHP, for example:
Code: Select all
<input type="text" name="item[]" value="test"/>
<input type="text" name="item[]" value="test two"/>
On your PHP page that retrieves the values you could then access each of those fields using arrays:
Code: Select all
$textfields = $_POST['item'];
foreach($textfields as $key => $value)
{
echo $value . '<br/>';
}
If you need anything else let me know
.
Thanks.
juma929
Forum Commoner
Posts: 72 Joined: Wed Jun 17, 2009 9:41 am
Post
by juma929 » Sat Jun 27, 2009 12:02 pm
Hello,
Just to clarify, in HTML form arrays you dont need the dollar sign ($)
.
Thanks.
Wolf_22
Forum Contributor
Posts: 159 Joined: Fri Dec 26, 2008 9:43 pm
Post
by Wolf_22 » Sat Jun 27, 2009 3:18 pm
Thanks juma929. That cleared it up perfectly.
juma929
Forum Commoner
Posts: 72 Joined: Wed Jun 17, 2009 9:41 am
Post
by juma929 » Sat Jun 27, 2009 3:30 pm
No problem, as I said if you ever need any more help at all just let me know and i'll do all I can
.
Thanks