Jump to content

Direct to webpage after form completion


lucy

Recommended Posts

How can i direct my users to a webpage once a form has been completed? I cant figure it out, i can only get it to echo text back on a white background.

 

here is the script, which is called by the form once submit is clicked:

<?

$user="n-web171-sau1"; //specially created username
$password="jackie01";
$database="web171-netlink";

//connect to the database
$con = mysql_connect("localhost",$user,$password) or die ('Could not connect: ' . mysql_error());

//select the database
mysql_select_db($database, $con);

//insert data into database
mysql_query("INSERT INTO customer (title, fname, sname, add1, add2, county, pc, email) VALUES ('$_POST[title]','$_POST[fname]','$_POST[sname]','$_POST[add1]','$_POST[add2]','$_POST[county]','$_POST[pc]', '$_POST[email]')") or die('Error: ' . mysql_error());

//close connection
mysql_close();

?>

 

the form itself is a php file, which is included in the main webpage (newcustomerform.php):

<form action="php/newcustomerscript.php" method="post">
  <p>Title:
    <input type="text" name="title" tabindex="1"/>
  </p>
  <p>Forename: 
    <input type="text" name="fname" id="fname" tabindex="2" />
  </p>
  <p>Surname: 
    <input type="text" name="sname" id="sname" tabindex="3" />
  </p>
  <p>
    Address line 1: 
    <input type="text" name="add1" id="add1" tabindex="4" />
  </p>
  <p>Address line 2: 
    <input type="text" name="add2" id="add2" tabindex="5" />
  </p>
  <p>County: 
    <input type="text" name="county" id="county" tabindex="6" />
  </p>
  <p>Postcode: 
    <input type="text" name="pc" id="pc" tabindex="7" />
  </p>
  <p>Email: 
    <input type="text" name="email" id="email" tabindex="8" />
  </p>
  <p>
    <input type="reset" name="clear" id="clear" value="Reset" />
    <input type="submit" name="submit" id="submit" value="Submit" />
  </p>
  <p> </p>
</form>

 

and the actual webpage itself:

<body>
<?php include("php/header.php"); ?>


<div id="content">
<?php include("php/newcustomerform.php"); ?>
</div>

</body>

 

Thanks

Lucy

Link to comment
https://forums.phpfreaks.com/topic/168928-direct-to-webpage-after-form-completion/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.