Help reqd with form design
Posted: Sat Dec 17, 2011 1:17 pm
Please help me with this simple form design -
For simplicity, lets say my form has 2 fields - name and email.
On submit, i want to do 3 things:
1) Send email
2) Insert into MYsql Db
3)redirect to a thankyoupage i get the - header already sent error
My form flow is somewhat like this
I am now using a JS redirect to keep this form functioning but, i want to use php to redirect to thankyou page
Do i need to change the form structure ?
PLease advise.
For simplicity, lets say my form has 2 fields - name and email.
On submit, i want to do 3 things:
1) Send email
2) Insert into MYsql Db
3)redirect to a thankyoupage
I have no issues with 1 and 2 above, but when i try to redirect using header(say thankyou.php)
Code: Select all
('Location: thankyou.php');My form flow is somewhat like this
Code: Select all
<?php
if (isset($_POST['submit']))
{
include (connect.php) // DB connect
$rname= $_POST['rname'];
$remail= $_POST['remail'];
// some php form validation
//php to send email code
// php to Insert into DB
header('Location: thankyou.php'); // - this is where i am getting stuck
}}else {
include_once ('header.php');
?>
<!-- Form Code Start -->
<h2>Member Registration</h2> <br/>
<form name="rform" class='form' action="'' method='POST' >
<label>Name </label> <input type='text' name='rname' maxlength="20" /> <br/>
<label>Email</label> <input type='text' name='remail' maxlength="40" /><br/>
<input class='button' type='submit' name='submit' value='SUBMIT TO JOIN'/>
</form> <!-- Form Code Ends -->
<?php } ?>
Do i need to change the form structure ?
PLease advise.