Results 1 to 5 of 5

Thread: PHP Code error

  1. #1
    Join Date
    Sep 2005
    Location
    everywhere.
    Posts
    1,087
    Tokens
    100

    Latest Awards:

    Default PHP Code error

    Hey guys,

    Im trying to make a php contact form, but theres something wrong with it and I cant figure out what. If someone could point me in the right direction?
    Many thanks.

    send_contact.php
    PHP Code:
    <?php
    // Contact subject
    $subject ="Save Reg Petiton Entry"
    // Details
    $message="$detail"
    // Mail of sender
    $mail_from="$customer_mail"
    // From 
    $header="from: $name <$mail_from>"
    // Enter your email address
    $to ='[email protected]'
    $send_contact=mail($to,$subject,$message,$header);
    // Check, if message sent to your email 
    // display message "We've recived your information"
    if($send_contact){
    echo 
    "We've recived your contact information";
    }
    else {
    echo 
    "ERROR";
    }
    ?>
    the form
    PHP Code:
    <body>
    <
    form action="contactsuccess.php" method="post">
    <
    div class="row"><label class="col1">Name:&nbsp;&nbsp;</label>
    <
    span class="col2"><input name="Name" class="input" type="text" id="Name" size="50" tabindex="1"  /></span>
    </
    div>
    <
    div class="row"><label class="col1">E-mail:&nbsp;&nbsp;</label>
    <
    span class="col2"><input name="Email" class="input" type="text" id="Email" size="50" tabindex="2" /></span>
    </
    div>
    <
    div class="row"><label class="col1comment">Comment:&nbsp;&nbsp;</label>
    <
    span class="col2comment"><textarea cols="20" class="textarea" rows="4" name="comment" id="comment" tabindex="4" ></textarea></span>
    </
    div>
    <
    div align="center" class="submit"><input type="image" src="images/b_send.gif" alt="send" width="52" height="19" border="0" />
    </
    div>
    </
    form>
    </
    body

    Thanks again;
    Heres a link to the page thing :: http://www.savereg.co.uk/petition.php
    Last edited by mike475; 04-02-2008 at 05:03 PM.
    lol rofl lmao etc..

  2. #2
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by mike475 View Post
    Hey guys,

    Im trying to make a php contact form, but theres something wrong with it and I cant figure out what. If someone could point me in the right direction?
    Many thanks.

    send_contact.php
    PHP Code:
    <?php
    // Contact subject
    $subject ="Save Reg Petiton Entry"
    // Details
    $message="$detail"
    // Mail of sender
    $mail_from="$customer_mail"
    // From 
    $header="from: $name <$mail_from>"
    // Enter your email address
    $to ='[email protected]'
    $send_contact=mail($to,$subject,$message,$header);
    // Check, if message sent to your email 
    // display message "We've recived your information"
    if($send_contact){
    echo 
    "We've recived your contact information";
    }
    else {
    echo 
    "ERROR";
    }
    ?>
    the form
    PHP Code:
    <body>
    <
    form action="contactsuccess.php" method="post">
    <
    div class="row"><label class="col1">Name:&nbsp;&nbsp;</label>
    <
    span class="col2"><input name="Name" class="input" type="text" id="Name" size="50" tabindex="1"  /></span>
    </
    div>
    <
    div class="row"><label class="col1">E-mail:&nbsp;&nbsp;</label>
    <
    span class="col2"><input name="Email" class="input" type="text" id="Email" size="50" tabindex="2" /></span>
    </
    div>
    <
    div class="row"><label class="col1comment">Comment:&nbsp;&nbsp;</label>
    <
    span class="col2comment"><textarea cols="20" class="textarea" rows="4" name="comment" id="comment" tabindex="4" ></textarea></span>
    </
    div>
    <
    div align="center" class="submit"><input type="image" src="images/b_send.gif" alt="send" width="52" height="19" border="0" />
    </
    div>
    </
    form>
    </
    body
    Thanks again;
    Heres a link to the page thing :: http://www.savereg.co.uk/petition.php
    LOL! at what your sites about,
    I can't really help, I suck at forms. I'll ask my bro'

  3. #3
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    youve set form action to contactsuccess.php instead of send_contact.php
    Coming and going...
    Highers are getting the better of me

  4. #4
    Join Date
    Jan 2008
    Posts
    287
    Tokens
    0

    Default

    Register globals?! Ew. Define and clean your $_POST[]'s not RG.
    I will look at it later.

    You also do not need to enclose your variables with ""'s,

    $bla = $bla is just fine.

    No need to put $bla = "$bla"; =\

  5. #5
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Definately clean your $_POST's in terms of \n and \r. I could fake a few emails using that ^_^

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •