Member Offer
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP Form Handling Script (Submitting Dreamweaver Forms)

Discussion in 'Website Coding & Programming Forum:' started by sweetums, Jul 21, 2009.

  1. sweetums

    sweetums Member

    I need to learn how to make forms that I create in Dreamweaver actually do something,
    so I've been watching a video on how to create PHP Form Handling Script. I've been through
    the video about 3 times and triple checked my code to make sure its the same as in the video
    but when I click submit on my created form I just get a blank page with no confirmation message
    and I never receive an email despite trying it with several different emails. :icon_Wall:

    So does anyone have any ideas about what I might be doing wrong or any suggestions
    on any other resources that I can use to learn about linking forms?

    Any help would be much appreciated as always!
  2. OliverB

    OliverB New Member


    The form does work, I followed this tutorial a few months ago. If you want me to have a look at it then post your php code on here.

    But if it's just the blank confirmation page make sure that you have the doc type included.
  3. sweetums

    sweetums Member

    Thanks for the answer Oliver,

    I know the form should work which is why I can't understand why mine does not.
    I've got the doc type included in the part that needs to be rendered in html so don't know what it wrong.
    I've created a .zip file of the entire root folder so you can check all of the stuff that I've done and see
    if you can work out what I've done wrong!
  4. OliverB

    OliverB New Member

    Ok I've had a look at your php script. What you need to do is this:

    This section below is wrong. They are not all called 'emailField'. They are called whatever you have called them in the HTML page.

    $emailField = $_POST['email'];
    $emailField = $_POST['name'];
    $emailField = $_POST['phone'];
    $emailField = $_POST['budget'];

    So it should be

    $emailField = $_POST['email'];
    $nameField = $_POST['name'];
    $phoneField = $_POST['phone'];
    $budgetField = $_POST['budget'];

    The next section is correct but you have missed out some '$' needs to be exactly the same as above.

    Also you need to copy the whole code for your 'thank you' page. So go to code view of your 'thank you' page, select all the code and copy. Paste this between
    $theResults = <<<EOD
    echo "$theResults";

    ....and that should work. If you preview your page and submit, the page will either display your 'thank you' page or the php code itself. Either way this will work when properly uploaded to the net.

    Hope this helps.
  5. sweetums

    sweetums Member

    Cheers for taking the time to have a look at my script,

    I've made all the corrections and made sure I've got all the code from the thank
    you page and when preview it and click submit it has now progressed from being
    a blank page to one that has all of the php code showing BUT when I upload it to
    my FTP site and test it I just reveive a blank page when I click submit. Could this
    be something to do with my web hoster or have I done something wrong.
    Again I've created a zip of all my pages here
  6. KevJaques

    KevJaques Member

    Hope you are sanitizing those form variables!! Otherwise it's a world of hurt!
  7. sweetums

    sweetums Member

    Well this is the first time I've ever done any PHP scripting so all I did was follow
    the tutorial that I linked to in my original post so I only know whats in that tutorial!
    What I need to be able to do is make my forms that I create in Dreamweaver
    actually do something when the submit button is pressed but I can't understand why
    the pages I create from the tutorial don't work
  8. OliverB

    OliverB New Member


    You have to upload everything. So you have to upload the page with the form on and the thank you page as well.

    Also on the html page with the form, do you have it linked to the php page? ie when you click on the form area (should be a red dotted line), in the properties bar there should be a field call 'actions' need to put your php file here. Also method should be 'post'.

    I really can't think of anything else really, just 100% check your code and where you want the email to go. I sent my script to your email, so you could just edit that. If i have any time i will take another look at you code.

    Hope this helps.
  9. sweetums

    sweetums Member

    Yes I have uploaded the whole "test" folder which contained all the pages that I created
    and I've checked the form area and I did have it linked to the php page with the method
    being set to "post" as you suggested it should be.
    I'll go through my code again as I can't think of what else could be wrong.
    Thanks for taking the time to respond though as you have been very helpful :)

Share This Page