quotations in value field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey people!

I have a problem with an email form of mine.
I want the user to be able to preview his message before sending it off to the hundreds of subscribers.
Problem is, if there's one or more double quotes (") in the subject (for which I use an input text field) it gets f*cked up.
Example:


Subject is: Mikael "emgee" Gron.
The code becomes: <input type="text" name="subject" value="Mikael "emgee" Gron">
This results in the value being = "Mikael "
which is very disturbing.


I've tryed not using any quotations in the input field (<in... ...lue=Mikael "emgee" Gron>), but that also gets quite fucked up as soon as for instance the beginning of the subject is within quotes, and the rest isn't. ("emgee" is his name)

I also tried doing this:
<textarea name="subject" cols="40" rows="1"><?php echo stripslashes($_POST['subject']) ?></textarea?>
which works as long as the user don't hit return or enter while the textarea is selected. Plus, trying to send multiple lines in the subject field surely could get quite messy.


Regards, Mike

PS: Here's a snippet of the code in action:

<b>The subject of the message</b><br>
<input type="text" name="subject" size="50" value="<?php echo stripslashes($_POST['subject']) ?>"><br>
<br>
<b>The message body</b><br>
<textarea cols="50" rows="25" name="body"><?php echo stripslashes($_POST['body']) ?></textarea><br>
<br>


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux