NameSilo

PHP Feedback form?

SpaceshipSpaceship
Watch

will7

VIP Member
Impact
29
I have written out some code for a PHP contact form. On my 'contact us' page, I have given the form the action: sendmail.php (yes, the file is called sendmail.php ;)). Here is the code I used:

PHP:
<?php
$to="[email protected]";
$subj="Lavastream General Enquiry";
$msg="Name: ".$_POST['name']." \r \n E-Mail: ".$_POST['email']." \r \n Message: ".$_POST['msg']." \r \n";
$header="From: ".$_POST['email']."; 

if(mail($to, $subj, $msg, $header))
{ 
header("Location: thanks.htm");
}
else
{
header("Location: notsent.htm");
}
?>

Then, when I use localhost (which has PHP enabled) and try to send an email using the form, I get this error:

Parse error: parse error, unexpected T_STRING in C:\Abyss Web Server\htdocs\lavastream\sendmail.php on line 9

Why? I need help!! I can't see any problems on line 9 or anywhere else. Can any of you?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains — AI StorefrontUnstoppable Domains — AI Storefront
Name this "feedback.php":

PHP:
<?php


// ************* MODIFY THE NEXT THREE LINES *****************************
$title = "Site Title"; // <--- PUT THE TITLE OF YOUR HOME PAGE BETWEEN THE "" MARKS
$home = "http://www.yourdomain.ext"; // <--- PUT YOUR URL BETWEEN THE "" MARKS
$mailto = "[email protected]"; // <--- PUT YOUR E-MAIL ADDRESS BETWEEN THE "" MARKS
// ********************* MODIFY NO MORE ********************************


// Thanks for the feedback etc.
header("Location: [url]http://www.domain.ext/ty.php[/url]"); 

// Scrape off the slashes before processing
$umsg = stripslashes($umsg);


// Here is where we grab and process the form and variables from mailform.php
// and e-mail the results to the value of "$mailto"


$mailfrom = "From: $uemail";
$subject= "$usubj";
$body = "* * * * * BEGIN FEEDBACK * * * * *\n\nSent from IP: $REMOTE_ADDR\nName: $uname\nEMail: $uemail\nSite: $uphone\nSubject: $usubj\nMessange: $umsg\n\n* * * * * END FEEDBACK * * * * *";

mail ($mailto, $subject, $body, $mailfrom);

?>


Name this "mailform.php":

<FORM ACTION="feedback.php" METHOD="POST" onSubmit= "return submitIt(this)">
<input type="hidden" name="REMOTE_ADDR" value="<? echo $REMOTE_ADDR;?>">
<table border=0 width="300">
<tr>
<td><font face="Arial">Name:</font></td><td><input name="uname" type="text" rows=1 value="<?php echo $uname;?>" size="37"></td>
</tr>
<tr>
<td><font face="Arial">Email:</font></td><td><input type=text name="uemail" rows=1 value="<?php echo $uemail;?>" size="37"></td>
</tr>
<tr>
<td><font face="Arial">Site:</font></td><td><input type=text name="uphone" rows=1 value="<?php echo $uphone;?>" size="37"></td>
</tr>
<tr>
<td><font face="Arial">Subject:</font></td><td><select name="usubj" value="<?php echo $usubj;?>" size="1">
<OPTION>-Choose-
<OPTION>Suggestion
<OPTION>Comment
<OPTION>Question
<OPTION>Broken Link
<OPTION>Affiliate
<OPTION>Other
</SELECT>
</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td>Message:</td>
<td><textarea name="umsg" rows=7 cols=26 value="<?php echo $umsg;?>" size="800"></textarea></td>
</tr>
<tr>
<td> </td>
<td>
<p><input type="submit" value="Submit" name="Send">   
<input type="reset" value="Reset" name="Reset"></td></tr></table></p>
</form>
 
Last edited:
0
•••
darn, ya beat me to it...
 
0
•••
Thanks for that code boricua, i was lookin for one
 
0
•••
Can't see my quickness iDeviseFlash

NP e39:D
 
0
•••
hehe, ill get you next time :p
 
0
•••
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy — Payment Flexibility
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back