Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Mar 2009
    Location
    Indiana
    Posts
    31
    Thanks
    5
    Thanked 0 Times in 0 Posts

    php select email form

    i am trying to make an email form that the user will go to and put in there "username" select the category for there article to submit is in(which will select which email to send it to) and then put in there title and the actual article. I had gotten everything to work except the username and title would not show up. and now that i have tried to get them to show up in the email, nothing is working now, the email is not even being sent. any help?

    PHP Code:
    <?php 
    $to 
    $_REQUEST['selectemail'];
    $title $_REQUEST['title']; 
    $article$_REQUEST['article'];
    $username $_REQUEST['username'];
    $subject "$title ARTICLE SUBMISSION"
    $email $_REQUEST['email'] ; 
    $message username$username article$article 
    $headers "From: $email"
    $sent mail($to$subject$message$headers) ; 
    if(
    $sent
    {print 
    "Your article was submited!<br> <a href='http://www.thesqrl.com/windowpop.html'>Send another article</a>"; }
    else 
    {print 
    "We encountered an error recieving your article! Please email technical support."; }
    ?>
    Code:
    <html>
    <head>
    <title>ARTICLE SUBMISSION </title>
    
    
    
    </head>
    <body bgcolor="#99ccff"><p align="center">
    <img src="popupheader.png">
    </p>
    
    <form action="sendarticle.php">
    <font color="red" face="tahoma"><u>*Articles are subject to spell checks*</u><br></font>
    USERNAME:<br><input type="text" name="username" size="50"><BR>
    
    EMAIL:<br><input type="text" name="email" size="50"><BR>
    
    CHOOSE A CATEGORY:<BR>
    <select name="selectemail">
    <option value="mattjamessawyer@hotmail.com">WORLD NEWS</option>
    <option value="news.us@thesqrl.com">US NEWS</option>
    <option value="news.politics@thesqrl.com">POLITICS</option>
    <option value="news.business@thesqrl.com">BUSINESS</option>
    <option value="news.culture@thesqrl.com">ART & CULTURE</option>
    <option value="news.tech@thesqrl.com">TECH</option>
    <option value="news.sports@thesqrl.com">SPORTS</option>
    <option value="news.misc@thesqrl.com">MISCELLANEOUS</option>
    </select>
    <hr width="50%"></hr>
    
    <u>ARTICLE</u><p>
    
    ARTICLE TITLE:<br>
    <input type="text" name="title" size="50"><BR>
    
    ARTICLE
    <textarea rows="15" cols="65" name="article"></textarea><p>
    
    <center>
    
    
    
    <input type="submit" value="SUBMIT ARTICLE" />
    
    
    
    news.world@thesqrl.com
    
    
    
    
    
    
    </body>
    </html>

  • #2
    GŁtkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    $message has to be a string:

    PHP Code:
    $message "username: $username article: $article"

  • #3
    New Coder
    Join Date
    Mar 2009
    Location
    Indiana
    Posts
    31
    Thanks
    5
    Thanked 0 Times in 0 Posts
    ok, thank you for that. i corrected it, but it is still not working. The rest of the code now is.

    PHP Code:
    <?php 
    $to 
    $_REQUEST['selectemail'];
    $title $_REQUEST['title']; 
    $article$_REQUEST['article'];
    $username $_REQUEST['username'];
    $subject "$title ARTICLE SUBMISSION"
    $email $_REQUEST['email'] ; 
    $message "username: $username article: $article" 
    $headers "From: $email"
    $sent mail($to$subject$message$headers) ; 
    if(
    $sent
    {print 
    "Your article was submited!<br> <a href='http://www.thesqrl.com/windowpop.html'>Send another article</a>"; }
    else 
    {print 
    "We encountered an error recieving your article! Please email technical support."; }
    ?>
    any other ideas?
    thanks

  • #4
    GŁtkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    You wrote you already got it to work, except for the username thing, so I am going to assume that PHP on your server is already configured to send mail.

    Other than that, your code works for me.

    I would change
    Code:
    <form action="sendarticle.php">
    to
    Code:
    <form action="sendarticle.php" method="post">
    though.

  • Users who have thanked venegal for this post:

    itssawyer (05-10-2009)

  • #5
    New Coder
    Join Date
    Mar 2009
    Location
    Indiana
    Posts
    31
    Thanks
    5
    Thanked 0 Times in 0 Posts
    thanks alot, its all working now.


  •  

    Posting Permissions

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