How do I make a submit button that will e-mail text directly to me and not bring up Outlook Express or Msn?
Printable View
How do I make a submit button that will e-mail text directly to me and not bring up Outlook Express or Msn?
This should do it.
PHP Code:<?php
if(isset($_REQUEST[submit])) {
mail("[email protected]", "My Subject", "Line 1\nLine 2\nLine 3");
}
Else {
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
<input type="Submit" name="submit" value="Send Mail">
</form>
<?php
}
?>
that didn't work
thanx anyway though
what do you mean it didnt work? what happened? what errors?
you forgot some " Gimlin :)
also you can't make a sumbit button send anyhting. it is the form that gets sent. tell us what error you get if any.
Oh, silly me :D
it came up saying the page cannot be displayed
if you could put in some " and then show me I would be really greatful
do you want it in php?
I added the qoute, in my code. But It seems like you dont even have PHP setup.
yeah if it says page not found then it does sound like you need php.
Can you show me it in php please, and then i will try it...I am really struggling to find the code..
My Site
uhh that code is in php.
try this in a new file called phpinfo.php
<?php
phpinfo();
?>
tell us what it displays?
can you show me the whole code please, because I am kinda new to this whole PHP thing....thanx
you are joking right? the whole code to what, to the code that is listed above? did you try waht I suggested????
you better read some more if you think there is more code.
i don't understand what you mean by
uhh that code is in php.
try this in a new file called phpinfo.php
<?php
phpinfo();
?>
because you said Can you show me it in php please, and then i will try it...I am really struggling to find the code and I was telling you that it is in php what Gimlin showed you. that my boy is php.
add this into a file. which means open notepad and copy this
<?php
phpinfo();
?>
into it and then save it as phpinfo.php make sure it doesn't have a .txt after it.
then upload it to your server and see if you can run it. tell us what it says when you do run it.
i understand what it does now, and I do have php support. I got it working, and it does everything it is supposed to except send the actual e-mail....you may have seen my other post...but this is the script I have...
<?php
$comment = stripslashes($comment);
$YourEmail = "[email protected]";
if (!$name) {echo "You must enter your name,<BR>Please go back and make corrections.<BR> Thank you"; } else {
if(!$email == "" && (!strstr($email,"@") || !strstr($email,"."))) {echo "You must enter a VALID Email Address,<BR> Hit the back button and enter your email address."; } else {
if (!$email) {echo "Email Field was empty, please enter your email."; } else {
if (!$comment) {echo "You must leave a comment.<BR>Go back and enter your comment"; } else {
if (!$fav_script) {echo "Choose your Favorite Script"; } else {
PRINT "<FONT SIZE=-1 face=verdana>";
PRINT "$name, Thank-you very much!!";
PRINT "<HR>";
PRINT "<B>Information Sent Via Email:</b>";
PRINT "<br><BR>";
PRINT "Name: $name";
PRINT "<BR>";
PRINT "Email: $email";
PRINT "<BR>";
PRINT "Favorite Scripting Technology: $fav_script";
PRINT "<BR>";
PRINT "Comments:$comment";
PRINT "<HR>";
PRINT "<B><a href=http://www.php50.com/circusmijit13>PLEASE CLICK HERE, To get back on our Site</a>";
PRINT "<hr>";
PRINT "</b></body>";
PRINT "</html>";
mail("$email", "Thanks For Your Email", "
Thank-you $name,
\nYou filled out our E-mail Form.\nThe Information that was submitted was:
\nName:$name\nEmail:$email\nFavorite Scripting Technology: $fav_script
Comment: $comment\n\nRegards,\nNick\nwww.realgoodhosting.com");
mail("$YourEmail", "Email Form Result", "
From: $name,
\n$name filled out our E-mail Form.\nThe Information that was submitted was:
\nName:$name\nEmail:$email\nFavorite Scripting Technology: $fav_script
Comment: $comment\n\nRegards,\nWebMaster\nwww.realgoodhosting.com");
}
}
}
}
}
?>
to many if's and else's. don't worry about checking for syntax and other stuff until you actually have the email sending. then after that you can add what ever you want.
yeah....but why won't the actual e-mail send?...I can't figure it out
what version of php are you running?
are you submitting from a form to that script?
i have no clue i just look at other people's scripts and then design my own by looking at the script....
you have to know how they work before you start taking other peoples scripts apart.
the reason it doesn't send any emials is becuase you didn't suplly it with one.
it makes a big difference if you tell us what version of php you are running?
i think it is 3...it said 1.0.3 or something.....and i did supply it with an e-mail address...i typed it in at $YourEmail = "[email protected]"
yeah you typed in "$YourEmail = "[email protected]""
but it was looking for $email
also there is no version 1.0.3 for php.
Just use my code for testing purposes.
What is you problem?...i said i wasn't sure and it was something like 1.0.3.....and i used the script you gave me, and yes, I do have php support
Perhaps your host does not provide support for the mail() funtion?
is there a way to find out if it does like the php one?
and like I said, did you run phpinfo() in that script I gave you? that will tell you everythign that is on your server that you are allowed to run. don't say yeah it ran because you would have seen all that stuff.
what happened to your post count scoutt :p
I leave for 6 months and you lose like 2500 posts :p
VBF had a massive crash, and the DB was royally fooked, alot of people lost accounts and posts.
Yeah, i've noticed a few :o
DaoK, wralston, scouut, DavidHooper
a few more that i haven't seen as well :(
:D yeah while everyone was getting posts I decided to go backwards. don't know why they haven't returned my regular posts, I told them twice. oh well life goes on, just not here.Quote:
Originally posted by da_silvy
what happened to your post count scoutt :p
I leave for 6 months and you lose like 2500 posts :p
i found the directory and now, how do I put that into my script?
sendmail_from:
[email protected]
sendmail_path:
/usr/sbin/sendmail -t -i
what directory?
Are you running this on your computer or on a server?
If on server, which server?
If at home, what server software are you using, example: apache, IIS, PWS etc.
Find out what version of PHP you are using. Do this by what scoutt said.
<?php
phpinfo();
?>
are you trying to upload a file to your server or send email?
it is trying to send an email :rolleyes:
whoops, wrong thread
i think he's posted another one like this regarding uploads :/