Hello, could you help me please? I have the code below. There is a form at form.php and sends some information (name, email, age) at insert.php where is the code below. In insert.php there is also another form for addinional information but I want data from the first form and the second one to be saved at MySQL simutaneously, as if it were one single form.

<?php

$con = mysql_connect("","","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("", $con);

$sql="INSERT INTO table (name, email, age)
VALUES
('$_POST[name]','$_POST[email]','$_POST[age]')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo " 
";

mysql_close($con);
?> 

<form action="insert.php" method="post">
my form for additional info......
</form>

Thank you in advane! :)

Just store the info of the first form in a session, and add it to the query after the second form.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.