11 Replies Latest reply on May 21, 2013 6:37 AM by vikki1987

    Some help with PHP and forms!


      Hi there,


      I have built a basic form in Dreamweaver (full code below) and i need the form details (once filled out) to be sent to a specified email address, the host server i use is 000webhost and they support PHP so no problems there. But, i am having majour problems writing the code as i don't have much knowledge of PHP, only HTML and CSS.

      I've looked online and have found some generic PHP form code but none of them work (even after making the relevant changes). I did notice that all the 'borrowed' PHP scripts were working fine with a form that was written in HTML as opposed to one built in Dreamweaver.

      Can anyone give me an insight to writing the correct code, the code i have tried so far is:



         $name = $_REQUEST['name'];

        $email = $_REQUEST['email'] ;

        $message = $_REQUEST['message'] ;


        mail( "yourname@example.com", "Feedback Form Results",

          $message, "From: $email" );

        header( "Location: http://www.example.com/thankyou.html" );



      But it does nothing. Also could someone explain the Name and ID pop up that comes up when creating a form in Dreaweaver, is it essential to fill out both fields?


      Many thanks and my HTML form code is below!


      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml">


      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

      <title>Untitled Document</title>





      <form id="form1" name="form1" method="post" action="">


          <label for="Name">Name</label>



          <input type="text" name="Name" id="Name" />



          <label for="Email">Email</label>



          <input type="text" name="Email" id="Email" />



          <label for="Message">Message</label>



          <textarea name="Message" id="Message" cols="45" rows="5"></textarea>



          <input type="submit" name="Sumbit" id="Sumbit" value="Submit" />