Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

Why need 2 forms, and your form1 has no submit button, when you submit, only form2 got submitted, try this:
XML
<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>
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900