Re: Php script for mail in a xhtml page

From: Date: Sat, 08 Sep 2007 01:24:42 +0000
Subject: Re: Php script for mail in a xhtml page
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-261829@lists.php.net to get a copy of this message
Mauro Sacchetto wrote:
I've to implement a php script in a web page to send mail. If I use a .html form and a separate .php script, all works fine. In the contrary, if I try to put the script into the .html file, I've some troubles... Here's the code: ... When I try to open the page, I receive this error: Parse error: syntax error, unexpected T_STRING in /var/www/netsons.org/samiel/form2.php on line 79 Do u see my error?
{Copies, pastes into editor that will number the lines ...} Well, looking in the vicinity of line 79, i'd say the problem lies with your reversed PHP tags: <input name="name" size="50" maxlength="40" value=?> echo $name. <?"> You've got another right below that: <input name="subject" size="50" maxlength="40" value="?>echo $subject;<?> And another: <textarea name="msg" cols="50" rows="8">?> echo $message;<?</textarea> Some other points: - You can do without the "echo" by using, eg. <?= $message ?> - Because this is an XHTML page, you should be closing your input tags and properly quoting the attributes: value="<?= $name ?>" /> - That your script's purpose is to send mail has nothing to do with how it displays in a browser. Anyway, that should do it. Be sure to validate the page. brian

« previous php.general (#261829) next »