468,468 Members | 2,690 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,468 developers. It's quick & easy.

How to link php forms

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
1 1336
xwero
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.

Similar topics

2 posts views Thread by Deborah V. Gardner | last post: by
4 posts views Thread by Mike Woinoski | last post: by
2 posts views Thread by mcraven.2 | last post: by
1 post views Thread by royal084 | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by kmladenovski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.