Page 1 of 1

PHP Form Mail Help

Posted: Sat May 26, 2007 11:33 am
by Dohnutt
Ok, so I found a tutorial for a PHP form mailer, here.

And it didn't work. So I'll post exactly what I posted there. Nobody has answered me, though. So, I thought maybe I'd get some more help here.



Ok, I'm trying to make three forms.
The first is a song request (this is for an online radio), in which I just want it to send an email to my friend. It is here.
As you can see, it's not exactly working. Theres an error.

request.php:

Code: Select all

<? else
{?>

    	<form method="post" action="songrequest.php">
	&nbsp;<b>Name:</b>&nbsp;&nbsp;<INPUT TYPE="TEXT" NAME="name" size=60><br>
	&nbsp;<b>Song:</b>&nbsp;&nbsp;
	<INPUT TYPE="TEXT" NAME="song" size=60>
	<p align="center"><input type="submit" name="submit" value="submit">
	<input type="reset" name="clear" value="clear"></p>
    	</form>

<? }?>
So, it's told to go to songrequest.php:

Code: Select all

<? //initilize PHP
if($submit) //If submit is hit
{
    mail("[b]email removed for privacy[/b]", "$name", "$song");
}?>

Thank you! <a href="index.php">Click here</a> to go back to Revolution Radio.

And then theres the Contact Us page. I want 2 forms; one for website help, and one for radio help. I just want name, email, and comments for both of them. It's here. Yes, another error. Similar to the other.

contact.php Website Form:

Code: Select all

<? else
{?>

    	<form method="post" action="websitecontact.php">
	&nbsp;<b>Name:</b>&nbsp;&nbsp;<INPUT TYPE="TEXT" NAME="name" size=60><br>
	&nbsp;<b>E-mail:</b>
	<INPUT TYPE="TEXT" NAME="email" size=60><br>
	&nbsp;<b>Comments:</b>&nbsp;<TEXTAREA NAME="comments" ROWS=10 COLS=30></TEXTAREA>
	<p align="center"><input type="submit" name="submit" value="submit">
	<input type="reset" name="clear" value="clear"></p>
    	</form>

<? }?>
contact.php Radio Form:

Code: Select all

<? else
{?>

    	<form method="post" action="radiocontact.php">
	&nbsp;<b>Name:</b>&nbsp;&nbsp;<INPUT TYPE="TEXT" NAME="name" size=60><br>
	&nbsp;<b>E-mail:</b>
	<INPUT TYPE="TEXT" NAME="email" size=60><br>
	&nbsp;<b>Comments:</b>&nbsp;<TEXTAREA NAME="comments" ROWS=10 COLS=30></TEXTAREA>
	<p align="center"><input type="submit" name="submit" value="submit">
	<input type="reset" name="clear" value="clear"></p>
    	</form>

<? }?>
And they point towards two different files; radiocontact.php:

Code: Select all

<? //initilize PHP
if($submit) //If submit is hit
{
    mail("[b]email removed for privacy[/b]", "$name", "$comments" , "$email");
}?>

Thank you!

<a href="index.php">Click here</a> to go back to Revolution Radio.
...and websitecontact.php:

Code: Select all

<? //initilize PHP
if($submit) //If submit is hit
{
    mail("[b]email removed for privacy[/b]", "$name", "$comments" , "$email");
}?>

Thank you!

<a href="index.php">Click here</a> to go back to Revolution Radio.


I'd just like to say that I'm not a very experience PHP'er. In fact, I have VERY little knowledge. I'm a copy/paste type person. Anyways, got any ideas? I appreciate it a whole bunch.


Thanks guys :)

RE: PHP Form Mail Help

Posted: Tue May 29, 2007 4:26 pm
by swbf_lase
Ok, this is whats wrong in request.php you need to change it to,

Code: Select all

<?else
{

     print "  <form method="post" action="songrequest.php">
   &nbsp;<b>Name:</b>&nbsp;&nbsp;<INPUT TYPE="TEXT" NAME="name" size=60><br>
   &nbsp;<b>Song:</b>&nbsp;&nbsp;
   <INPUT TYPE="TEXT" NAME="song" size=60>
   <p align="center"><input type="submit" name="submit" value="submit">
   <input type="reset" name="clear" value="clear"></p>
       </form>";
 }?>
Basically by adding print to the other forms as well, it'll work. But, also I see no if statement for else to work with! So thats also why its not working. I'm not exactly sure where your if statement is so if you could show me that...

Could you please post the WHOLE request.php? I need to see the rest of it...

EDIT: Actually, can you just PM me the whole source package?

RE: PHP Form Mail Help

Posted: Wed May 30, 2007 6:57 pm
by Dohnutt
No problem. I'll PM it to you now. By source package, you mean all of the files attached to it through php, right?

RE: PHP Form Mail Help

Posted: Wed May 30, 2007 8:06 pm
by swbf_lase
yep.

RE: PHP Form Mail Help

Posted: Thu May 31, 2007 5:30 pm
by Dohnutt
Ok, I sent it yesterday.