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
Share on other sites

I have not outputted anything to the screen, it just automatically goes to a blank white screen, therefore i could use this?

 

do i need to include the Location part i.e. header('Location:http://www.google.com/'); would be fine?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.