Jump to content

need help with form


maluch

Recommended Posts

hello, I'm sure this question was asked before,  but I was unable to find a similar thread. I'm using 1and1.com to host my site and can't get my form to work. Everything seems to be right but upon hitting the submit button I get a http 405 error(invalid verb, http method). I had my friends(comp sci majors) review the code, but they could find nothing wrong. I found something on google that indicates a permission problem. Any thoughts? Thanks.

Link to comment
https://forums.phpfreaks.com/topic/55161-need-help-with-form/
Share on other sites

form http:

          <td><form action="email.php" method="post" name="form1" target="_parent" id="form1">

            <div align="right">

              <table width="611" border="0">

                <tr>

                  <td width="161"> </td>

                  <td width="440"><span class="style35">**Note: <span class="style33">All information optional, but some required for contact.</span></span></td>

                </tr>

              </table>

              <br />

              <p>Name:

                <input name="name" type="text" id="name" size="60" />

                <br />

                <br />

                Email<span class="style23">**</span>:

                <input name="email" type="text" id="email" size="60" />

                  <br />

                  <br />

                Phone Number<span class="style23">**</span>:

                <input name="phone" type="text" id="phone" size="60" />

                  <br />

                  <br />

                How did you become aware of JanPol?

                <input name="reference" type="text" id="reference" size="60" />

                  <br />

                  <br />

                Job Description/Comments:

                <textarea name="comments" cols="57" rows="10" id="comments"></textarea>                 

                <br />

                  <br />

                  <br />

                </p>

            </div>

            <table width="661" border="0">

  <tr>

    <td width="274" height="26"> </td>

    <td width="298"><input type="submit" name="Submit" value="SUBMIT" /></td>

    <td width="75"><label>

      <input name="Reset" type="reset" id="Reset" value="reset" />

    </label></td>

  </tr>

</table>

                    </form> 

 

php code:

<?php

 

        $to= "[email protected]"; // Your email address goes here.

$subject= "Email z Janpol.org strony internetowej";

$body= "Email zostal wyslany przez " . $_REQUEST['name'] . " Tej osoby adres emailowy:  " . $_REQUEST['email'] . " <br />

Tej osoby numer telefonu:  " . $_REQUEST['phone'] . " <br />

Ta osoba dowiedziala sie o JanPol z:  " . $_REQUEST['reference'] . " <br />

Email zostal wyslany: " . date("F j, Y, g:i a") . "<br />

<br /><br />" . $_REQUEST['comments'];

 

if (mail($to, $subject, $body)) // mail() is a boolean function

{

echo("<p>Message successfully sent!</p>");

sleep(3);

header("Location: contact.html");

}

else

{

echo("<p>Message delivery failed...Please make sure all the information that you have provided is valid.</p>");

sleep(3);

header("Location: contact.html");

}

?>

 

Maybe I could use chmod to change the permission settings? Thanks a lot.

Link to comment
https://forums.phpfreaks.com/topic/55161-need-help-with-form/#findComment-272670
Share on other sites

I noticed u are using $_reguest rather than $_post

try the following:

<?php
   
        $to=      "[email protected]";   // Your email address goes here.
   $subject=   "Email z Janpol.org strony internetowej";
   $body=      "Email zostal wyslany przez " . $_POST['name'] . " Tej osoby adres emailowy:  " . $_POST['email'] . "

            Tej osoby numer telefonu:  " . $_POST['phone'] . "

            Ta osoba dowiedziala sie o JanPol z:  " . $_POST['reference'] . "

            Email zostal wyslany: " . date("F j, Y, g:i a") . "

            

" . $_POST['comments'];
   
   if (mail($to, $subject, $body))   // mail() is a boolean function
    {   
      echo("<p>Message successfully sent!</p>");
      sleep(3);
      header("Location: contact.html");
   }
   else
   {   
      echo("<p>Message delivery failed...Please make sure all the information that you have provided is valid.</p>");   
      sleep(3);
      header("Location: contact.html");
   }
?>

I did not check the rest of your code

Link to comment
https://forums.phpfreaks.com/topic/55161-need-help-with-form/#findComment-272673
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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