Jump to content

HTML q tag doubt


Ignatius881

Recommended Posts

the way you have it now it will appear as.. "I am God" wrapped in quotes.. are you saying that you just want God to be in quotes..?

 

:(

 

Okay, the code that I wrote is this:

 

<textarea name="message" style="font-weight: bold; width: 570px; height: 250px;" cols="30%" rows="5"></textarea>

 

It's for a forum, and it uses many HTML tags. So, when an user writes something and I want to quote his text, I want the username to appear together with his quoted text, not only his quoted text.

Link to comment
https://forums.phpfreaks.com/topic/244922-html-q-tag-doubt/#findComment-1258139
Share on other sites

depending on whether you are storing this in a database.. you can add the username to the string before insertion.. perhaps something like..

 

$message = $_POST['message']; //grab the contents of your textarea.. assuming that your form method is post
$username = $_SESSION['username']; //however your store your usernames.. retrieve the correct username..
$message = "{$username}: $message"; //add username however you want
$message = mysql_real_escape_string($message); //sanitize data.. prepare for db insertion
$sql = "INSERT INTO table (message) VALUES ('$message')"; //replace with correct credentials..
$query = mysql_query($sql) or die(mysql_error()); //die() for debugging

 

then when you are ready to retrieve the message.. wrap it in <q>/q> tags..

Link to comment
https://forums.phpfreaks.com/topic/244922-html-q-tag-doubt/#findComment-1258146
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.