By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,825 Members | 1,449 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,825 IT Pros & Developers. It's quick & easy.

How to link php forms

P: 7
Im running Apache(1.3.23), MySQL(3.23.48) and PHP(4.1.1) locally on my PC to create a form. This form will consist of 2 pages where the first one is user detail and second is company detail.

My question is, how do I link these 2 pages together?

Page 1 is as below. My process.php is where I collect the data and submit it to mysql.
[php]
<body>
<form action="process.php" method="post">
<p>&nbsp;</p>
<h1>
<pre><center><img src="pemudawilayah.GIF" width="115" height="102" align="right" /></center></pre>
<center>
<p>&nbsp;</p>
<p><b>PROGRAM KEBAJIKAN </b></p>
</center></h1>
<pre><center><p>&nbsp;</p><p><strong>Maklumat Peserta</strong></p></center> </pre>
<p><br />
Nama:
<input type="text" name="nama">
<br>
etc[/php]
Process.php is as below:
[php]<body>
<?php
$con = mysql_connect("localhost","fitri","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("umnodb", $con);

$sql="INSERT INTO maklumatpeserta (Nama, TarikhLahir, NoKeahlian, Phone, AlamatTerkini, Cawangan, Bahagian, Jawatan)
VALUES
('$_POST[nama]','$_POST[tarikhlahir]','$_POST[nokeahlian]','$_POST[phone]','$_POST[alamatterkini]','$_POST[cawangan]','$_POST[bahagian]','$_POST[jawatan]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record succefully added";
mysql_close($con)
?>
</body>[/php]
Page 2 is as below:
[php]<form action="process2.php" method="post">
<p>&nbsp;</p>
<h1>
<pre><center><img src="pemudawilayah.GIF" width="115" height="102" align="right" /></center></pre>
<center>
<p>&nbsp;</p>
<p><b>PROGRAM KEBAJIKAN </b></p>
</center></h1>

<pre><center><p>&nbsp;</p><p><strong>Maklumat Pekerjaan</strong></p></center> </pre>
<p><br />
Majikan Terkini:
<input type="text" name="majikanterkini">
<br>
Alamat Majikan:
<input type="text" name = "alamatmajikan">
Tempoh:
<input type="text" name="tempoh" >
<br />
Telefon Majikan:
<input type="text" name="telefonmajikan">
<br>
Alamat Terkini:
<input type="text" name = "alamat">
<br>
Email:
<input type="text" name="email">
etc[/php]Im very new to this programming stuff. Can someone pls help me?

Thx.

Read the Posting Guidelines before you post in this forum!. Especially the part about enclosing code within php or code tags!

moderator
Feb 6 '07 #1
Share this Question
Share on Google+
1 Reply


P: 99
instead of outputting in process.php redirect the page
Feb 10 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.