Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script for inserting data from multiple form

Status
Not open for further replies.

JJJ777

Programmer
Jun 5, 2002
33
MY
hi there,
im using php4 with postgresql. I really need help on editing my script (below) to make sure it can insert data to table from multiple forms (3 form). I also not familiar with session variable and hidden value , therefore i really need a sample of script.

<?
include &quot;./config.inc&quot;;
$link_id = db_connect($user_dbname);
$query = &quot;INSERT INTO student_profile (stud_name,stud_ic,stud_iccolor,stud_birthdate,
stud_gender,stud_maritalstatus,stud_nationality,stud_race,stud_religion,
stud_bank_branch,stud_accountno)
values ('$name','$ic','$iccolor','$birthdate','$gender','$marital',
'$nationality','$race','$religion','$bbranch', '$accno')&quot;;
$result = pg_exec($link_id,$query);
if (!$result) {
echo &quot;!!!!&quot;;
echo &quot;$query\n&quot;;
$errormessage = pg_errormessage($link_id);
echo $errormessage;
exit;
}
echo &quot;<center>All values were successfully inserted into database<center> &quot;;
pg_close();

?>

* i would like to seperate it into 3 part which is 3 form difrrent pages.
example:
1st form: name,ic, ic color and birthdate
2nd form : gender , marital status, nationality and race
3rd form ; religion,bank branch and account number.

the submit button will be in page 3.
help please!
 
include the other fields as hidden form values --BB
 
Hidden form elements look like this:
Code:
<input type=&quot;hidden&quot; name=&quot;field_name&quot; value=&quot;field_value>

For example, on page two you could have this php code for the $name variable:
Code:
<input type=&quot;hidden&quot; name=&quot;name&quot; value=&quot;<?php echo $name ?>&quot;>

You could simply do that for each variable.

Here's W3C info on the different input types:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top