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

contact forms

Options
  • 15-07-2012 12:36am
    #1
    Registered Users Posts: 1,298 ✭✭✭


    Have the forms laid out in html

    what i need to know is how do i link my php page to my html page to make the poxy thing work :)


Comments

  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    I presume you didn't write the code in the PHP page, but got it from a third party. If so, I suggest you read whatever documentation came with the script.


  • Registered Users Posts: 1,082 ✭✭✭Feathers


    In a general sense, it's the action attribute of the form that tells it where to post if you're reading up on it. But as TC says, unless you're coding the handler from scratch, you probably have some docs somewhere.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    The docs are important as many such third-party forms may require settings sent in hidden form fields or other configurations to work properly.


  • Registered Users Posts: 1,298 ✭✭✭off.the.walls


    <?php

    $name=$_POST;
    $email=$_POST;
    $message=$_POST;

    $to="off.the.walls@live.ie";
    $subject="Grasp Web Mail Alert";
    $body="This is an automated message your message has been recieved, do not reply to this message.";
    mail ($to,$subject,$body);

    echo 'Message Sent!<a href="contact.html">Click Here</a>To Send Another';


    ?>



    iv id="content" class="container">
    <form action="send.php" method="POST">
    Name <br/> <input type="text" name="name" /><br/>
    Email <br/> <input type="text" name="email" /><br/>
    Message <br/> <textarea name="message"></textarea>
    <input type="submit" class-"submit" name="Send" />



    thats the php and the html, just keeps telling me i need a server?


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    If you're doing this on your local machine, then you don't have a mail server; hence the error.

    Secondly, all that PHP script will do is sent you an email with the text: "This is an automated message your message has been received, do not reply to this message", which isn't much use. You would need to incorporate the data from the form in some way, like this:
    [PHP]$body = "Sender: ".$name."\nEmail: ".$email."\nMessage: ".$message."\n";[/PHP]
    It's not a very secure script, TBH.


  • Advertisement
  • Closed Accounts Posts: 9,700 ✭✭✭tricky D


    Are you writing the script from scratch yourself? If so, you would be much better off grabbing one of the many formmail scripts already out there. They will be properly hardened for security.


  • Registered Users Posts: 1,298 ✭✭✭off.the.walls


    got it off a youtube tutorial.


  • Closed Accounts Posts: 9,700 ✭✭✭tricky D


    Grab yourself formmail: http://www.scriptarchive.com/formmail.html or a similar script. It's pretty easy to set up.

    The one you are using is way, way too basic with little security, customisation, checking etc... What you are using is like a wooden wheel compared to a modern day car wheel.


  • Registered Users Posts: 1,298 ✭✭✭off.the.walls


    Cheers for the help lads. Think i may grab myself a book on php haha


Advertisement