
November 2nd, 2004
05:26 AM
Neverside Newbie
Status: Offline!
PHP Form Mail
hi i got this code off spoono.com:
<p><? //initilize PHP
if($submit) //If submit is hit
{
mail("info@email.com", "$subject", "$email", "$comments");
}?>
<? else
{?>
<form method="post" action="comments.php">
<font size="2" face="Verdana">
*E-Mail:<br/><INPUT TYPE="TEXT" NAME="email" size=60><br/><br/>
*Subject:<br/><INPUT TYPE="TEXT" NAME="subject" size=60><br/><br/>
*Comments:<br/><TEXTAREA NAME="comments" ROWS=10 COLS=30></TEXTAREA><br/><br/>
<input type="submit" name="submit" value="Submit"><br/><br/>
* = Required Fields
</font>
</form>
<? }?>
when the submit button is pressed the page is reloaded as the 'page cannot be found' page. how can i edit the code i send it to like a confirmation page sayin stuff like your request has been sent blah blah

November 2nd, 2004
05:41 AM
Pawn Coder
Status: Offline!
<?
if($submit) //If submit is hit
{
mail("info@email.com", "$subject", "$email", "$comments");
echo "Your email has been sent!";
// or
include("thankyou.htm");
}
else
{
?>
<form method="post" action="<? echo "$PHP_SELF"; ?>">
<font size="2" face="Verdana">
*E-Mail:<br/><INPUT TYPE="TEXT" NAME="email" size=60><br/><br/>
*Subject:<br/><INPUT TYPE="TEXT" NAME="subject" size=60><br/><br/>
*Comments:<br/><TEXTAREA NAME="comments" ROWS=10 COLS=30></TEXTAREA><br/><br/>
<input type="submit" name="submit" value="Submit"><br/><br/>
* = Required Fields
</font>
</form>
<? }?>
Try that.
___________________
- Moderator at the official AMX Mod X forums

November 2nd, 2004
08:46 AM
thinking of something witty to put here
Status: Offline!
Please, don't get code from Spoono.

November 2nd, 2004
08:53 AM
Pawn Coder
Status: Offline!
Originally posted by Radley
Please, don't get code from Spoono.
True true...Good advice.
___________________
- Moderator at the official AMX Mod X forums

November 2nd, 2004
02:59 PM
Why the hell would somebody go to the trouble of writing a whole bunch of useless code and posting it up on spoono. It's just rediculously stupid. Like hotscripts.com aswell, most of the scripts on there dont even work.

November 2nd, 2004
03:11 PM

I made this script (just getting more WORKING scripts out there)
<?php
if (isset($submit)) {
if(isset($name) && isset($subject) && isset($email) && isset($message)) {
$msg = "Site: " . $url . "\n\rMessage: " . $message;
$sucfail = mail("myemail@domain.com","$subject","$msg","From: $name <$email>");
if($sucfail == TRUE) { echo "Email sent! Thanks for you comments, suggestions or questions.<br />"; }
else { echo "Email sending failed... Either you broke it, I broke it, or you didn't fill out the form.<br />";
}
} else {
echo "Please fill all fields to send.<br />";
}
} else {
echo "<form action=\"\" method=\"post\"><input type=\"text\" name=\"name\" value=\"Name\"
onfocus=\"if(this.value == 'Name') this.value='';\" onblur=\"if(this.value=='') this.value='Name';\"
onclick=\"this.value=''\" /> <input type=\"text\" name=\"url\" value=\"Website\" onfocus=\"
if(this.value == 'Website') this.value='';\" onblur=\"if(this.value=='')
this.value='Website';\" onclick=\"this.value=''\" /><br />
<input type=\"text\" name=\"email\" value=\"Email\" onfocus=\"if(this.value == 'Email')
this.value='';\" onblur=\"if(this.value=='') this.value='Email';\" onclick=\"this.value=''\" />
<input type=\"text\" name=\"subject\" value=\"Subject\" onfocus=\"if(this.value == 'Subject')>
this.value='';\" onblur=\"if(this.value=='') this.value='Subject';\" onclick=\"this.value=''\" /><br />
<textarea name=\"message\" rows=\"6\" cols=\"60\" onfocus=\"if(this.value=='Message')this.value='';\">Message</textarea><br />
<input name=\"submit\" type=\"submit\" value=\"Send\" /> <input type=\"reset\"
value=\"Clear the form\" /></form>";
}
?>
___________________

Last edited by MinDFreeZ, November 2nd, 2004 03:14 PM (Edited 1 times)