Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-23-2009, 08:44 PM
tipoboy's Avatar
tipoboy tipoboy is offline
 
Join Date: Dec 2005
Location: scotland
Posts: 693
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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&nbsp;&nbsp;</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&nbsp;&nbsp;</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&nbsp;&nbsp;</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>
what i'd like to do is instead of using text in a fieldset with the thank you or error outputs, i'd like to link to a thank you page and an error page, am in the process of trying to learn some php and any assistance is grately appreciated

ta very much
dave
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:44 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03334 seconds
  • Memory Usage 2,222KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete