Page 1 of 1

Need help with feedback form script

Posted: Sun Nov 30, 2008 6:15 am
by ieattrees0
hi i am new here and i need help with my feedback form script. the script sends me the email when i press submit button but it is always empty here is my script

Code: Select all

<?php
$firstname = $_REQUEST['firstname'] ;
  $lastname = $_REQUEST['lastname'] ;
  $contactnumber = $_REQUEST['contactnumber'] ;
  $email = $_REQUEST['email'] ;
  $facilityname = $_REQUEST['facilityname'] ;
  $moveindate = $_REQUEST['moveindate'] ;
  $monthlyprice = $_REQUEST['monthlyprice'] ;
  $facilityrating = $_REQUEST['facilityrating'] ;
mail( "marroz88@gmail.com", "Feedback Form Results",
    $message, "From: $email" );
  header( "Location: http://www.example.com/thankyou.html" );
?>
 

Code: Select all

<form method="post" action="sendmail.php">
<table width="722" height="274" border="0">
  <tr>
    <th width="187" scope="col"><div align="center" class="style1">First Name</div></th>
    <th width="184" scope="col"><label>
     <input name="firstname" type="text"/><br />
    
    </label></th>
    <th width="179" scope="col"><div align="center" class="style1">Facility Name</div></th>
    <th width="190" scope="col"><div align="center">
      <label>
      <input name="facilityname" type="text" />
      </label>
    </div></th>
  </tr>
  <tr>
    <td><div align="center" class="style1">Last Name</div></td>
    <td><div align="center">
      <label>
     <input name="lastname" type="text" />
      </label>
    </div></td>
    <td><div align="center" class="style1">Move in Date</div></td>
    <td><div align="center">
      <label>
      <input name="moveindate" type="text"" />
      </label>
    </div></td>
  </tr>
  <tr>
    <td><div align="center" class="style1">Contact Number</div></td>
    <td><div align="center">
      <label>
      <input name="contactnumber" type="text" />
      </label>
    </div></td>
    <td><div align="center" class="style1">Monthly Price</div></td>
    <td><div align="center">
      <label>
     <input name="monthlyprice" type="text" />
      </label>
    </div></td>
  </tr>
  <tr>
    <td height="24"><div align="center" class="style1">Email</div></td>
    <td><div align="center">
      <label>
      <input name="email" type="text" />
      </label>
    </div></td>
    <td><div align="center">
      <p>Facility Rating </p>
      </div></td>
    <td><label>
      <select name="select" id="select">
        <option>1 poor</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
        <option>5 excellent</option>
      </select>
    </label></td>
  </tr>
  <tr>
    <td height="60">&nbsp;</td>
    
    <br />
    </td>
    
    <td colspan="2">
<label for="tswcomments">Comments on Facility</label><br />
<textarea rows="5" cols="45" name="comments" id="tswcomments" ></textarea></td>
    </tr>
  <tr>
    <td height="60">&nbsp;</td>
    <td><label>
      <input type="submit" name="submit" id="submit" value="Submit" />
    </label></td>
    </tr>
</table>
<p>&nbsp;</p>
</form>

Re: Need help with feedback form script

Posted: Sun Nov 30, 2008 11:51 am
by Yossarian

Code: Select all

# <?php
 $firstname = $_REQUEST['firstname'] ;
   $lastname = $_REQUEST['lastname'] ;
   $contactnumber = $_REQUEST['contactnumber'] ;
   $email = $_REQUEST['email'] ;
   $facilityname = $_REQUEST['facilityname'] ;
   $moveindate = $_REQUEST['moveindate'] ;
   $monthlyprice = $_REQUEST['monthlyprice'] ;
   $facilityrating = $_REQUEST['facilityrating'] ;
 
 // I can't see where you are putting anything in message
 // so heres an example
 $message = "Hello $firstname $lastname here is your message" ;  
 $message .="blah de blah" ;
 $message .="blah de blah" ;
 $message .="Goodbye, and that you for the interest you have shown in Blah" ;
 
 mail( "marroz88@gmail.com", "Feedback Form Results",
     $message, "From: $email" );
   header( "Location: http://www.example.com/thankyou.html" );
 ?>
You need to filter those incoming variables before you stick them in an email script too.

Ask if unsure.

Re: Need help with feedback form script

Posted: Sun Nov 30, 2008 12:31 pm
by ieattrees0
thanks for the quick response but can you explain more please. im new to all this so still learning.

Re: Need help with feedback form script

Posted: Sun Nov 30, 2008 2:00 pm
by Yossarian
ieattrees0 wrote:thanks for the quick response but can you explain more please. im new to all this so still learning.
Well, you have nothing in your email because you have nothing in $message as far as I can see.

Did you try the code I posted, did it not work for you?

Re: Need help with feedback form script

Posted: Sun Nov 30, 2008 10:26 pm
by ieattrees0
solved the problem thanks for the help