Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-10-2009, 04:00 PM   PM User | #1
itssawyer
New Coder

 
Join Date: Mar 2009
Location: Indiana
Posts: 31
Thanks: 5
Thanked 0 Times in 0 Posts
itssawyer is an unknown quantity at this point
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>
itssawyer is offline   Reply With Quote
Old 05-10-2009, 04:03 PM   PM User | #2
venegal
Gütkodierer


 
Join Date: Apr 2009
Posts: 2,127
Thanks: 1
Thanked 426 Times in 424 Posts
venegal has a spectacular aura aboutvenegal has a spectacular aura about
$message has to be a string:

PHP Code:
$message "username: $username article: $article"
venegal is offline   Reply With Quote
Old 05-10-2009, 04:08 PM   PM User | #3
itssawyer
New Coder

 
Join Date: Mar 2009
Location: Indiana
Posts: 31
Thanks: 5
Thanked 0 Times in 0 Posts
itssawyer is an unknown quantity at this point
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
itssawyer is offline   Reply With Quote
Old 05-10-2009, 04:26 PM   PM User | #4
venegal
Gütkodierer


 
Join Date: Apr 2009
Posts: 2,127
Thanks: 1
Thanked 426 Times in 424 Posts
venegal has a spectacular aura aboutvenegal has a spectacular aura about
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.
venegal is offline   Reply With Quote
Users who have thanked venegal for this post:
itssawyer (05-10-2009)
Old 05-10-2009, 04:51 PM   PM User | #5
itssawyer
New Coder

 
Join Date: Mar 2009
Location: Indiana
Posts: 31
Thanks: 5
Thanked 0 Times in 0 Posts
itssawyer is an unknown quantity at this point
thanks alot, its all working now.
itssawyer is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:44 PM.


Advertisement
Log in to turn off these ads.