Ignatius881 Posted August 16, 2011 Share Posted August 16, 2011 Hello. I have a doubt. I want the name of a quoted person to appear together with the quoted text, but it seems that the q tag hasn't that function. Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted August 16, 2011 Share Posted August 16, 2011 can you give an example of what you mean.. Quote Link to comment Share on other sites More sharing options...
Ignatius881 Posted August 16, 2011 Author Share Posted August 16, 2011 can you give an example of what you mean.. This one, for example So, when I write "<q>I am God</q> No, you're not God", I want the name of "God" to appear. Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted August 16, 2011 Share Posted August 16, 2011 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..? Quote Link to comment Share on other sites More sharing options...
Ignatius881 Posted August 16, 2011 Author Share Posted August 16, 2011 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. Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted August 16, 2011 Share Posted August 16, 2011 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.. Quote Link to comment Share on other sites More sharing options...
Ignatius881 Posted August 16, 2011 Author Share Posted August 16, 2011 Thanks. Now, suppose that I want the users to not be able to use the q tag. How can I block a tag? Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted August 16, 2011 Share Posted August 16, 2011 without knowing how you are enabling the <q> tag in the first place.. it's hard to say.. Quote Link to comment Share on other sites More sharing options...
Ignatius881 Posted August 16, 2011 Author Share Posted August 16, 2011 without knowing how you are enabling the <q> tag in the first place.. it's hard to say.. I didn't enable any tag, all was enabled by default (bold, italic, image, quote...) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.