Re: Quotation marks in HTML form values

Karl DeSaulniers <[email protected]>
Newsgroups gmane.comp.php.database
Message-ID <[email protected]>
On Jun 14, 2012, at 11:35 PM, Ron Piggott wrote:

>
> I have setup the following echo after a database query:
>
> <?php
> echo "<input type=\"text\" name=\"description\" value=\"" .  
> $email_template['description'] . "\" class= 
> \"contact_center_email_template_maintenance_user_input_data\" />\r\n";
> ?>
>
> What I don’t understand is what to do in the event the variable  
> $email_template['description'] retrieved in the database query  
> contains a quotation mark “ --- In this event only the word  
> “current” populates the “description” field
>
> <input type="text" name="description" value="current "Verse of the  
> Day daily devotion" e-mail template"  
> class="contact_center_email_template_maintenance_user_input_data" />
>
> Ron Piggott
>
>
>
> www.TheVerseOfTheDay.info

Try this

<input type="text" name="description" value="<?php  
echo(htmlspecialchars($email_template['description'])); ?>"  
class="contact_center_email_template_maintenance_user_input_data" />

or keep it all inside the echo like you had it.

<?php
echo "<input type=\"text\" name=\"description\" value=\"" .  
htmlspecialchars($email_template['description']) . "\" class= 
\"contact_center_email_template_maintenance_user_input_data\" />\r\n";
?>

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.