Jump to content

Selecting $_POST[0]?


Perad

Recommended Posts

i'm sorry i am still not sure what your trying to do.

 

basic example!

<form method="post">
<input name="test1" type="text"><br>
<input name="test2" type="text"><br>
<input name="test3" type="text"><br>
<input name="test4" type="text"><br>
</form>

<?php
$t1 = $_POST['test1'];
$t2 = $_POST['test2'];
$t3 = $_POST['test3'];
echo "$t1, $t3, $t3, etc";
?>

Link to comment
https://forums.phpfreaks.com/topic/71084-selecting-_post0/#findComment-357432
Share on other sites

for ($i=0;$i<=count($item)-1;$i++)
	{
	<input type=\"submit\" class=\"select\" name=\"$item[$i]\" value=\"\">			
	}

 

Multiple forms... each submit button has a different name. Name is based on the item code and thus I do not know it. Only one submit button can be pressed. Because I cannot put in $_POST['name'] I need to be able to sign the first value in the $_POST array to a variable. I tried $_POST[0] but it didn't work. furthermore current($_POST) also didn't work.

Link to comment
https://forums.phpfreaks.com/topic/71084-selecting-_post0/#findComment-357434
Share on other sites

try

<form method="POST">
<input type="submit" name="name1" value="Click me" />
<input type="submit" name="name2" value="Click me" />
<input type="submit" name="name3" value="Click me" />
<input type="submit" name="name4" value="Click me" />
</form>
<?php
$post_fliped=array_flip($_POST);
echo $post_fliped['Click me'];
?>

Link to comment
https://forums.phpfreaks.com/topic/71084-selecting-_post0/#findComment-357457
Share on other sites

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.