RE: [PHP] HELP!! What wrong with this code...

From: Date: Tue, 31 Jul 2001 20:22:42 +0000
Subject: RE: [PHP] HELP!! What wrong with this code...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-60501@lists.php.net to get a copy of this message
You have received a number of responses on this. Here is another. When assigning text or html in a variable (or for echo) it is generallly a good idea to use single quotes and exit for variable insertion. That way you don't have to worry about missing one or two errant HTML wuotes. For example echo '<P align=center>Your feedback has been sent to <a>href="mailto:$address">'.$name.'</a></P>'; is perfectly valid, and I have found that this method tends to work better with HTML editors as well (with PHP support) as a side note; If you are fond of GUI interfaces like Drwamweaver, you may want to exit and reenter PHP tags to allow you to continue to edit the page in these GUI editors instead of using echo. For example <P align=center>Your feedback has been sent to <a>href="mailto:$address"><?PHP echo $name; ?></a></P>'; this is especially usefull when creating multiple nested tables or otherwise sloppy HTML editing since you can usually edit the PHP tag directly from the GUI HTML editor Dave >-----Original Message----- >From: Steve Wright [mailto:steve@stevewrightonline.co.uk] >Sent: Tuesday, July 31, 2001 12:13 PM >To: PHP List >Subject: [PHP] HELP!! What wrong with this code... > > >Hey, i am getting an error passed back for this line of code, the rest >of the code is below: > >echo "<P align=center>Your feedback has been sent to <a >href="mailto:$address"ÙÊ(« >…˜î~ü5ÿÄX>$name</a></P>"; > >the error is: > >Parse error: parse error, expecting ','' or >';'' in >/www/customers/stevewrightonline.co.uk/form/do_sendform.php on line 20 > > >Does anyone know y this is?? If i remove the a href tags it works >fine. Can you not use links properly in PHP?? > >------------------ ><?php >$name = "Steven Wright"; >$address ="auto_form@stevewrighjtonline.co.uk"; >$recipient = $address; >$subject = "Auto Form"; >$mailheaders = "From: Auto Form < $address > \n"; >$mailheaders = "Reply-To: $sender_email\n\n"; > >/*The Message*/ >$msg = "Sender:\t mailto:$sender_email \t >$sender_name\n\n"; >$msg = "Message:\t$message\n\n"; > >/*Mail to Me*/ >mail($recipient, $subject, $msg, $mailheaders); > > >/*Onscreen confirmation of sending*/ >echo "<HTML><HEAD><TITLE>Form >Sent!</TITLE></HEAD><BODY>"; >echo "<H1 align=center>Thank You, $sender_name</H1>"; >echo "<P align=center>Your feedback has been sent to <a >href="mailto:$address">$name</a></P>"; >echo "</BODY></HTML>"; >?> > >

« previous php.general (#60501) next »