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

php help please...........

Options
  • 28-12-2006 6:15pm
    #1
    Closed Accounts Posts: 69 ✭✭


    right this is wrecking my inexperienced head....

    flash contact form for www.lovoncon.com

    contact.php reads:

    <?php

    $your_name=$_GET;
    $your_phone=$_GET;
    $your_email=$_GET;
    $your_message=$_GET;

    $recipient_email = "declanor@gmail.com";
    $headers = "From" . $your_name . "<" . $your_email . ">\n";
    $headers .='content-type: text/html; charset=iso-8859-1';

    $content ="<html><title>contact letter</head><br>";
    $content .="name: <b>" . $your_name . "/b><br>";
    $content .="phone: <b>" . $your_phone . "/b><br>";
    $content .="e-mail: <b>" . $your_email . "/b><br><hr><br>";
    $content .= $your_message;
    $content .= "<br></body></html>";

    mail($recipient_email,$subject,$content,$headers);

    ?>

    <html>
    <body bgcolor="#282e2c">
    <div align="center" style="margin-top:60px;color:#FFFFFF;font-family:tahoma;font-weight:bold">
    Your Message Was Sent, Thank You.
    </div>
    </body>
    <html>


    <script>
    resizeTo(300, 300);
    // window.close()
    </script>






    summit buttom on site is:



    on (rollOver) {
    gotoAndPlay("s1");
    }
    on (releaseOutside, rollOut) {
    gotoAndPlay("s2");
    }
    on (release) {
    _parent.getURL("contact.php","_blank_","GET");
    _parent.your_name="Your Name:";
    _parent.your_phone="Your Phone:";
    _parent.your_email="Your E-Mail:";
    _parent.your_message="Message:";
    }









    Where am i going wroung???????????/

    Please help.............


Comments

  • Registered Users Posts: 32,136 ✭✭✭✭is_that_so


    What is the value of $subject? There doesn't seem to be one.


  • Closed Accounts Posts: 69 ✭✭rara


    could that be my proble?

    all i recieve in the mail to declanor@gmail.com is:

    From<>
    content-type: text/html; charset=iso-8859-1

    <html><title>contact letter</head><br>name: <b>/b><br>phone: <b>Phone:/b><br>e-mail: <b>/b><br><hr><br>Your message:<br></body></html>


  • Registered Users Posts: 32,136 ✭✭✭✭is_that_so


    It looks more like field name issues. and there also seems to be a problem with closing tags as well. e.g. /b

    Here's a bit of code that does work, which you may help you with your own. Just adjust the POST values to GET values. Make sure that the field names match. Judging by the URL on the Thank you page the email field is actually called "your%5Femail"

    // Needed for HTML mail headers

    $from_header = 'MIME-Version: 1.0' . "\r\n";
    $from_header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

    $to=$_POST;
    $name=$_POST;
    $from=$_POST;
    $subject="test";
    $from_header .= "From: $from";

    $body="<html>text<br /></html>";


    mail($to, $subject, $body, $from_header);


  • Registered Users Posts: 6,414 ✭✭✭kdouglas


    in the form, you seem to have the fields named as:
    _parent.your_name="Your Name:";
    _parent.your_phone="Your Phone:";
    _parent.your_email="Your E-Mail:";
    _parent.your_message="Message:";

    but in the php file you are trying to read:
    $your_name=$_GET;
    $your_phone=$_GET;
    $your_email=$_GET;
    $your_message=$_GET;

    so change to $_GET; etc....

    might wanna fix that </b> tag also: $content .="name: <b>" . $your_name . "/b><br>";

    you might want to read up on php mail() injection attacks, the way your form is handled currently would easily allow your script to be abused. have a look at http://www.securephpwiki.com/index.php/Email_Injection


  • Registered Users Posts: 6,414 ✭✭✭kdouglas


    also, that's ALOT of data to send by a get request, try using post instead, looks much cleaner for a start.


  • Advertisement
  • Closed Accounts Posts: 69 ✭✭rara


    thanks alot kdouglas, at least is now working aftre a fashion.

    The post method, is there much involved to modify. I am totaly clueless when it comes to this stuff but ur advice so far worked!!


  • Registered Users Posts: 32,136 ✭✭✭✭is_that_so


    You could use the code I posted.
    Your form in general would be

    <form name="form" method="post" action="thankyoufile">
    all the other form stuff

    </form>

    So you would have

    $your_name=$_POST;
    $your_phone=$_POST;
    $your_email=$_POST;
    $your_message=$_POST;

    No idea about the Flash code though.


  • Closed Accounts Posts: 1,200 ✭✭✭louie


    You have a lot of work to make it work the right way.

    first change the method in the form from get to post
    <form name="form_name" method="post" action="contact.php">
    ...........
    </form>
    

    then change the fields name removing the white spaces from "your name" to "your_name" or just "name"
    <input type="text" name="name" />
    

    on the contact.php page change the $_GET to $_POST or $_REQUEST

    you should also try validating the fields before submiting the form so they are not empty values. you probably got a lot of blank emails in the last few hours.


Advertisement