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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.