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!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi
I have a form that is created with diferents fields, the user pick 3 fields, so the form for this user as field1 field2 and field3, but other user may need 4 fields so the form is created with 4 fields, field1 field2 field3 and field4.
So my question is: is possible create name of variables dynamic? the code that i want is to catch all the fields that i have in my form:
<?php
$field1 = $_GET['field1'];
$field2 = $_GET['field2'];
#to make this in a for cicle, for my variables names have the "field".$i - where $i is the nunmber of the field
# example, if $i=1 i wnat to create a code line like this $field1 = $_GET['field1'];
# field is fixed name and the rest of the name of the variable came from $i
#is this possible?
?>
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
For what i wnat i think the multi arrays is the best solution, but how do i get the values in the php code:
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Something is not working!!!
in my form file i have this:
<?php
for($i=1; $i<=$num_rpms; $i++){
$rpm_name[$i] = $_POST['name'][$i];
print($rpm_name[$i]."<br />");
#the $num_rpms is the variable where i keep how many fields i have
}
?>
But i can't see anything in the screen!! What i'm doing wrong?
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]