Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem with Contact Form - Please help!!

    Hi there,

    I get the following error message when using what i think should be the correct php script for my contact form.

    Error 405 Method Not Allowed

    The requested method POST is not allowed for URL /contact.php



    How can I solve this?

    My host server does support PHP.

    Thanks!!

    Contact form html is:

    Code:
    <p align="left"><FORM ACTION="contact.php" METHOD="post">  
    	<div align="left">
    		<table border="0" 	cellspacing="1" style="border-collapse: collapse" >
    		<tbody class="body_main">
    			
    				
    				<tr>
    					<td>
    					<b><font face="Tahoma" size="2" color="#FF6600">Name:</font></b></td>
    					<td class="body_small">
    						
    						<input type="text" name="name" size="20" /> </td>
    
    				</tr>
    				
    				<tr>
    					<td>
    					<b><font face="Tahoma" size="2" color="#FF6600">Contact Tel:</font></b></td>
    					<td class="body_small">
    						
    						<input type="text" name="tel" size="20" /> </td>
    				</tr>
    				
    				<tr>
    
    					<td>
    					<b><font face="Tahoma" size="2" color="#FF6600">Email:</font></b></td>
    					<td class="body_small">
    						
    						<input type="text" name="email" size="30" /> <br>
    					</td>
    				</tr>
    				
    				
    				
    				<tr>
    					<td valign="top"><b>
    
                        <font face="Tahoma" size="2" color="#FF6600">Message:</font></b></td>
    					
    						<td class="body_small">
    						<textarea cols="44" rows="5" input type="text" name="message" /></textarea><br>
    							<br>
    								&nbsp;</td>
    				</tr>
    				
    										&nbsp;</td>
    				</tr>
    
    			</tbody>
    		</table>
    	</div>
    	<p><div align = "center">
    	<font face="Verdana"><input value="Submit" type="submit"></div> 
        <p></p>
        </font>
          </form>

    PHP code is:

    Code:
    error_reporting(E_ERROR | E_WARNING | E_PARSE);
    ini_set('track_errors', true);
    
    function DoStripSlashes($FieldValue) 
    { 
     if ( get_magic_quotes_gpc() ) { 
      if (is_array($FieldValue) ) { 
       return array_map('DoStripSlashes', $FieldValue); 
      } else { 
       return stripslashes($FieldValue); 
      } 
     } else { 
      return $FieldValue; 
     } 
    }
    
    #----------
    # FilterCChars:
    
    function FilterCChars($TheString)
    {
     return preg_replace('/[\x00-\x1F]/', '', $TheString);
    }
    
    
    if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
     $ClientIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
    } else {
     $ClientIP = $_SERVER['REMOTE_ADDR'];
    }
    
    $FTGT1 = DoStripSlashes( $_REQUEST['T1'] );
    $FTGT2 = DoStripSlashes( $_REQUEST['T2'] );
    $FTGS1 = DoStripSlashes( $_REQUEST['S1'] );
    
    
    
    # Redirect user to the error page
    
    if ($ValidationFailed === true) {
    
     header("Location: http://www.itstravel.co.uk/ITS/contactfailed");
     exit;
    
    }
    # Email to Form Owner
    
    $emailSubject = FilterCChars("Enquiry from ITS Website");
    
    $emailBody = "Name : $FTGT1\n"
     . "Email : $FTGT2\n"
     . "Phone : $FTGS1\n"
     . "";
     $emailTo = "ITS <enquiry@itstravel.co.uk>";
      
     $emailFrom = FilterCChars("$FTGT2");
      
     $emailHeader = "From: $emailFrom\n"
      . "MIME-Version: 1.0\n"
      . "Content-type: text/plain; charset=\"ISO-8859-1\"\n"
      . "Content-transfer-encoding: 8bit\n";
      
     mail($emailTo, $emailSubject, $emailBody, $emailHeader);
    
    
    # Redirect user to success page
    
    header("Location: http://www.itstravel.co.uk/ITS/thankyou");
    exit;
    ?>

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,548
    Thanks
    8
    Thanked 1,094 Times in 1,085 Posts
    $FTGT1 = DoStripSlashes( $_REQUEST['T1'] );
    $FTGT2 = DoStripSlashes( $_REQUEST['T2'] );
    $FTGS1 = DoStripSlashes( $_REQUEST['S1'] );

    Where does T1,T2 and S1 come from?
    And why is it $_REQUEST instead of $_POST?

  • #3
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    And why is it $_REQUEST instead of $_POST?
    It's more flexible to use $_REQUEST than specifically $_POST or $_GET.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •