Click here to Skip to main content
14,575,017 members
Rate this:
Please Sign up or sign in to vote.
See more:
<form action="index.php" name="form1" method="post">
<input type="text" name="contact_name" value="Carl" />
</form>

<form action="index.php" name="form2" method="post">
<input type="text" name="contact_last_name" value="Mora" />
<input type="submit" name="checkdetails" value="Check" />
</form>

if (isset($_POST['checkdetails']))
{
echo "Name: ".$_POST['contact_name']."Last name: ".$_POST['contact_last_name'] ;
}
?>

this code doesn't work ;( there another way to do it ? i need get data in distinct forms when i does click in any submit
Posted

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Why need 2 forms, and your form1 has no submit button, when you submit, only form2 got submitted, try this:
<form action="index.php" name="form1" method="post">
<input type="text" name="contact_name" value="Carl">
<input type="text" name="contact_last_name" value="Mora">
<input type="submit" name="checkdetails" value="Check">
</form>
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100