Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Php webform question?

  • 09-02-2010 7:27pm
    #1
    Registered Users, Registered Users 2 Posts: 2,985 ✭✭✭


    Hi,

    I've gone wrong somewhere when doing the php for a simple webform, I really know f all about php so I would appreciate if somebody could help me. :)

    When I click send I get this message

    [HTML]Parse error: syntax error, unexpected $end in /home/theirish/public_html/registrationformprocess.php on line 38[/HTML]FWIW line 38 is the very last line

    [PHP]<?php

    $emailSubject = 'Irish Series of Poker Registration';
    $webMaster = 'registration@theirishseriesofpoker.com';

    $nameField = $_POST;
    $emailField = $_POST;
    $phoneField = $_POST;
    $eventField = $_POST;
    $commentsField = $_POST;

    $body = <<<EOD

    <br><hr><br>
    Name: $name <br>
    Email: $email <br>
    Phone: $phone <br>
    Event: $event <br>
    Comments: $comments <br>
    EOD;

    $headers = "From: $email\r\n";
    $headers = "Content-type: text/html\r\n";
    $success = mail($webMaster, $emailSubject, $body, $headers);



    $theresults = <<<EOD
    <html>
    <body>
    Thank you for registering
    </body>




    </html>EOD;echo = "$theresults";
    ?>[/PHP]


Comments

  • Closed Accounts Posts: 7,145 ✭✭✭DonkeyStyle \o/


    Drop the EOD; bit down to its own line, and drop the echo= part below that.
    Also you don't need to use echo like that.
    [php]</html>
    EOD;
    echo $theresults;[/php]
    And you should be cleaning that user input... which if you don't know php could prove to be challenging.
    It'd be better to search for an already developed form mail script that does it all properly.


  • Registered Users, Registered Users 2 Posts: 2,985 ✭✭✭Essien


    Sorted, cheers DonkeyStyle \o/


  • Registered Users, Registered Users 2 Posts: 2,985 ✭✭✭Essien


    OK, Not sorted, the email isn't picking up the data, I'm just getting blank forms frown.gif


  • Registered Users, Registered Users 2 Posts: 2,236 ✭✭✭techguy


    What webhost are you using? Is it your own server or a commercial host.

    If it's your own then it's probably down to havin misconfigured mail settings in PHP.

    I could never get this to work on my personal server but the same code would run fine on a commercial host like hosting365 or whatever.

    Just letting you know in case you think there's something wrong with your PHP. There's probably not.


  • Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭Webmonkey


    OP, can you be more specific in what you mean that the forms are empty? - you mean the fields in which a value should be present in the email are all blank?


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,985 ✭✭✭Essien


    Webmonkey wrote: »
    OP, can you be more specific in what you mean that the forms are empty? - you mean the fields in which a value should be present in the email are all blank?

    Yes, sorry, the fields are empty, when I recieve the mail all I see is....
    Name:
    Email:
    Phone:
    Event:
    Comments:


  • Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭Webmonkey


    Essien wrote: »
    Yes, sorry, the fields are empty, when I recieve the mail all I see is....
    Ok then, but should it not be this:

    [php]
    <br><hr><br>
    Name: $nameField <br>
    Email: $emailField <br>
    Phone: $phoneField <br>
    Event: $eventField <br>
    Comments: $commentsField <br>
    [/php]

    The way you have it will only work if globals enabled which is off by default now as security risk. You should use the variables name you assigned to the post variables/fields.


  • Registered Users, Registered Users 2 Posts: 2,985 ✭✭✭Essien


    Webmonkey wrote: »
    Ok then, but should it not be this:

    [php]
    <br><hr><br>
    Name: $nameField <br>
    Email: $emailField <br>
    Phone: $phoneField <br>
    Event: $eventField <br>
    Comments: $commentsField <br>
    [/php]The way you have it will only work if globals enabled which is off by default now as security risk. You should use the variables name you assigned to the post variables/fields.

    Easy when you know how, thanks very much Webmonkey :)


  • Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭Webmonkey


    Essien wrote: »
    Easy when you know how, thanks very much Webmonkey :)
    No probs!


Advertisement