The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
php contact form help redirecting to a thank you page
hi there i am using a php page as a contact form, the code is:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <?php if(isset($_POST['submit'])){ //GET ALL FORM INFO INTO VARIABLES $name = $_POST['name']; $SAFEname = htmlentities($name); $email = $_POST['email']; $SAFEemail = htmlentities($email); $contactnumber = $_POST['contactnumber']; $SAFEcontactnumber = htmlentities($contactnumber); $subject = $_POST['subject']; $SAFEsubject = htmlentities($subject); $message = $_POST['message']; $SAFEmessage = htmlentities($message); $to = 'enquiries@mysite.co.uk'; $subject = 'Contact Forrm'; $msg = "Name: ".$SAFEname."\nEmail: ".$SAFEemail."\nContact Number: ".$SAFEcontactnumber."\nSubject: ".$SAFEsubject."\nMessage: ".$SAFEmessage."\n"; $headers = "From: ".$SAFEemail."\nReply-To: ".$SAFEemail."\nReturn-Path: ".$SAFEemail."\n"; if($SAFEname != "" && $SAFEmessage != ""){ mail($to, $subject, $msg, $headers); echo "<fieldset><legend>Thank You </legend>Thank you for emailing us, please allow up to 48 hours for a reply! Very occasionally it may take longer to reply, please be patient with us If you have not had a reply within 7 days please feel free to email again!</fieldset>"; } else { echo "<fieldset><legend>Error </legend>Please fill in all requires fields, thank you.</fieldset>"; }} ?> <html> <head> <title>Contact Page</title> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <table id="main" width="660" border="1" cellpadding="0" cellspacing="0"> <tr> <td width="790"><img src="images/baner.gif" alt="welcome" width="385" height="65"></td> </tr> <tr> <td><table width="650" border="0"> <tr> <td class="navigation" width="120" rowspan="2" valign="top"> <?php require("navigation.php") ?> </td> <td><p class="heading">::: welcome :::</p><hr width="90%"></td> </tr> <tr> <td><fieldset> <legend>Contact Us </legend> <form method="post" action="contactus.php"> <table width="500" border="0" cellpadding="5" cellspacing="5" class="contact"> <tr> <td colspan="2"><p class="second"><font color="#FF0000">All fields are required to be filled otherwise an error will occur, thank you</font></p></td> </tr> <tr> <td class="contact">Name:</td> <td class="contactinput"><input name="name" type="text" size="25" maxlength="50"> <font color="#FF0000" size="1"><em>*required</em> </font></td> </tr> <tr> <td class="contact">Email:</td> <td class="contactinput"><input name="email" type="text" size="25" maxlength="100"> <font color="#FF0000" size="1"><em>*required</em> </font></td> </tr> <tr> <td class="contact">Contact Number:</td> <td class="contactinput"><input name="contactnumber" type="text" size="25" maxlength="20"> <font color="#FF0000" size="1"><em>*required</em> </font></td> </tr> <tr> <td class="contact">Subject:</td> <td class="contactinput"><select name="cusubject" id="cusubject"> <option>Please Select From The Following:</option> <option>E-mail a Question</option> <option>Request a Price List</option> <option>Request More Information</option> <option>New Year Reel Information</option> <option>Other</option> </select> <font color="#FF0000" size="1"><em>*required</em> </font></td> </tr> <tr> <td class="contact">Message:</td> <td class="contactinput"><textarea name="message" cols="27" rows="5" id="message"></textarea> <font color="#FF0000" size="1"><em>*required</em> </font></td> </tr> <tr> <td></td> <td class="contactinput"><input name="submit" type="submit" value="Send message" class="submit"></td> </tr> </table> </form> </fieldset><br> </td> </tr> </table></td> </tr> <tr> <td class="copyright" height="21" colspan="3"><br> <?php require("copyright.php"); ?> </td> </tr> </table> </body> </html> ta very much dave |
#2
|
||||
|
||||
Wow... Didn't look down the list of threads in this area? I mean, it's right there on the first page.
https://vborg.vbsupport.ru/showthread.php?t=206347 |
#3
|
||||
|
||||
Quote:
Code:
header("Location: http://www.example.com/"); Code:
Warning: Cannot modify header information - headers already sent by (output started at /home/*******/public_html/mysite.co.uk/contactus.php:2) in /home/*******/public_html/mysite.co.uk/contactus.php on line 28 but if there is an error i get directed tio an error.php page but thank you for your reply either way |
#4
|
||||
|
||||
Did you do the last post I gave in that thread? Using the ob_end_flush() function?
|
#5
|
||||
|
||||
You must have no output before running that PHP code. You have this at the top of the page (and is considered output):
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
#6
|
||||
|
||||
Quote:
thanks dismounted thats worked, got it working now |
#7
|
||||
|
||||
That's why I suggested using ob_end_flush(). Using that function allows you to have output before doing the redirect.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|