Jump to content

[SOLVED] Variables within $_Post?


chester

Recommended Posts

I have a form of undetermined length. I generate form field names with a loop. On the process page I would like to access the $_Post data with another loop. My attempt does not work:

for($i=0; $i<$num_rows; $i++){
	$temp = "'update_status".$i."'";
	echo $temp."<br>";
	echo "Status".$i." : ".$_POST[$temp]."<br>";
}

Does anyone have a suggestion on how to do this? Thank you.

Link to comment
https://forums.phpfreaks.com/topic/140949-solved-variables-within-_post/
Share on other sites

Revraz - If I can get it to work with this field name it should be easy enough to apply it to other ones.

 

Rhodesa - Thank you for that link, it looks like it may be helpful. My form now looks like:

echo "<select name=\"update_status[".$i."]\">";

and my process code looks like:

for($i=0; $i<$num_rows; $i++){
	echo "Status".$i." : ".$_POST['update_status[$i]']."<br>";
}

Am I not accessing the array correctly?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.