ClioSport.net

Register a free account today to become a member!
Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • When you purchase through links on our site, we may earn an affiliate commission. Read more here.

php peeps again..



  306 TD Slut
hi, i have this code for a form on my website. i dont know anything about php, but am told this is basic lol. just gets form info from the form and sends it to my yahoo address.

Code:
//Configuration
    $email_address = "[EMAIL="mark.simons@yahoo.co.uk"]mark.simons@yahoo.co.uk[/EMAIL]"; //This should be changed to your email address.
    $subject_prefix = "From marksimons.co.uk ";  //This will be the subject prefix of all emails. default "Website Contact - User Subject
// --- Do not modify below ---
//Collects varibles from previous page.
    $name = $_POST['name'];
    $email = $_POST['email'];
    $subject = $subject_prefix . $_POST['subject'];
    $message = $_POST['message'];
//This part should prevent malicous doings.
//Most servers are setup in such a way that this section is not needed but its a good security precaution to have.
   $from = urldecode($email);
   if (eregi("\r",$from) || eregi("\n",$from)){
           print "Malformed Headers were detected.";
        exit;
   }
//This part sends the email to you.
    mail($email_address, $subject, $message, "From: $name <$email>\nX-Mailer: Simple PHP Contact Form 1.0 ([URL="http://www.korske.com"]www.korske.com[/URL])");
//Redirects to sent.html  
    header("Location: sent.html")
?>

i got it working and now receive info, BUT.

when i recieve the email in my yahoo inbox no matter what the user types in the address and name field, it doesnt give it to me.

if someone filled in the fields like this:

name: mark
address: mark_r52002@hotmail.com
subject: testy
message: blah blah

i would recieve it and it would say:

from: mark@yahoo.com,
subject:testy
message: blah blah

how is it getting the name and using it in the from email field, and more to the point.. where the hell is it getting the @yahoo.com bit as it was not entered into any of the box's.

thanky :)
 

KDF

  Audi TT Stronic
hi, i have this code for a form on my website. i dont know anything about php, but am told this is basic lol. just gets form info from the form and sends it to my yahoo address.

Code:
//Configuration
    $email_address = "[EMAIL="mark.simons@yahoo.co.uk"]mark.simons@yahoo.co.uk[/EMAIL]"; //This should be changed to your email address.
    $subject_prefix = "From marksimons.co.uk ";  //This will be the subject prefix of all emails. default "Website Contact - User Subject
// --- Do not modify below ---
//Collects varibles from previous page.
    $name = $_POST['name'];
    $email = $_POST['email'];
    $subject = $subject_prefix . $_POST['subject'];
    $message = $_POST['message'];
//This part should prevent malicous doings.
//Most servers are setup in such a way that this section is not needed but its a good security precaution to have.
   $from = urldecode($email);
   if (eregi("\r",$from) || eregi("\n",$from)){
           print "Malformed Headers were detected.";
        exit;
   }
//This part sends the email to you.
    mail($email_address, $subject, $message, "From: $name <$email>\nX-Mailer: Simple PHP Contact Form 1.0 ([URL="http://www.korske.com"]www.korske.com[/URL])");
//Redirects to sent.html  
    header("Location: sent.html")
?>

i got it working and now receive info, BUT.

when i recieve the email in my yahoo inbox no matter what the user types in the address and name field, it doesnt give it to me.

if someone filled in the fields like this:

name: mark
address: mark_r52002@hotmail.com
subject: testy
message: blah blah

i would recieve it and it would say:

from: mark@yahoo.com,
subject:testy
message: blah blah

how is it getting the name and using it in the from email field, and more to the point.. where the hell is it getting the @yahoo.com bit as it was not entered into any of the box's.

thanky :)

I cant see anything wrong.. it *SHOULD* be working..

Do some diagnostic work.. have it print out all the values to screen.. make sure the script is getting all the correct values before processing...
 
  306 TD Slut
its really bizarre. take ages to get delivered to my inbox too and always goes to spam

html:

Code:
<form id="myform" class="cssform" action="send.php" method="post">
       <div id="formBox">
        <div class="field">
       <p>
       <label for="user">Full Name:</label>
       <input type="text" name='name' value="" style="border:dotted;border-width:1px;border-color: #CCCCCC; height:20px;" />
       </p>
        </div>
        <div class="field">
       <p>
       <label for="emailaddress">Email Address:</label>
       <input type="text" name+'email' value="" style="border:dotted;border-width:1px;border-color: #CCCCCC; height:20px;" />
       </p>
        </div>
        <div class="field">
       <p>
       <label for="user">Subject:</label>
       <input type="text" name='subject' value="" style="border:dotted;border-width:1px;border-color: #CCCCCC; height:20px;">
       </p>
        </div>
        <div class="field">
       <p>
       <label for="comments">Message:</label>
       <textarea name='message' rows="5" cols="25" style="border:dotted;border-width:1px;border-color: #CCCCCC;"></textarea>
       </p>
        </div>
       </div><!--formBox--> 
 
       <div style="margin-left: 150px; position: relative; height:51px;">
       <input type="image" value="" name="submit" src="images/sumbit.gif" alt="submit" border="0"/>       
        </div>
       </form>
ignore the css.

php:

Code:
//Configuration
    $email_address = "[EMAIL="mark.simons@yahoo.co.uk"]mark.simons@yahoo.co.uk[/EMAIL]"; //This should be changed to your email address.
    $subject_prefix = "From marksimons.co.uk ";  //This will be the subject prefix of all emails. default "Website Contact - User Subject
// --- Do not modify below ---
//Collects varibles from previous page.
    $name = $_POST['name'];
    $email = $_POST['email'];
    $subject = $subject_prefix . $_POST['subject'];
    $message = $_POST['message'];
//This part should prevent malicous doings.
//Most servers are setup in such a way that this section is not needed but its a good security precaution to have.
   $from = urldecode($email);
   if (eregi("\r",$from) || eregi("\n",$from)){
           print "Malformed Headers were detected.";
        exit;
   }
//This part sends the email to you.
    mail($email_address, $subject, $message, "From: $name <$email>\nX-Mailer: Simple PHP Contact Form 1.0 ([URL="http://www.korske.com/"]www.korske.com[/URL])");
//Redirects to sent.html  
    header("Location: sent.html")
?>
 

sn00p

ClioSport Club Member
  A blue one.
Code:
       [FONT=monospace]
[/FONT]<input type="text" name+'email' value="" style="border:dotted;border-width:1px;border-color: #CCCCCC; height:20px;" />

That should be name='email' not name+'email'

I suspect that's the root cause of your problems.
 
  306 TD Slut
yep! thats weird that you mention that now, i literally just picked up on that and uploaded a new version. thanks!
 

KDF

  Audi TT Stronic
haha...

its funny how you dont notice things like that until someone else points it out ;)

Glad you got it sorted, the slow mail delivery is probably just your host btw.
 


Top