rhyspaterson Posted April 13, 2007 Share Posted April 13, 2007 Hey guys, More of a question than help needed Using the below code to submit data within three separate textareas into a database. $_POST['answer'] = $_POST['textarea1'].$_POST['textarea2'].$_POST['textarea3']; At the moment the data in each textarea is just plain text. However if wanted to format the data entered into the textarea before submitting it to the database (['answer']) how would i go about it? Would i have to copy the textarea data into a variable, format it (into say a larger and different font), and then post it? Any tips (or guides) would be much appreciated! Cheers, /Rhys Quote Link to comment Share on other sites More sharing options...
btherl Posted April 13, 2007 Share Posted April 13, 2007 "Text" cannot be in different font sizes.. so I presume you mean using HTML tags? For example $str = "<font size=+2>" . $str . "</font>"; Is this what you have in mind? If possible, I would do the font size changes when you display the data, rather than when you store it. It's good to keep that seperation between storage and display. Quote Link to comment Share on other sites More sharing options...
trq Posted April 13, 2007 Share Posted April 13, 2007 Date saved into a database has no concept of larger or different font. That is a client side issue which has nothing to do with php or databases. Data should be stripped of any dangerous characters but otherwise saved in its raw state. Quote Link to comment Share on other sites More sharing options...
rhyspaterson Posted April 13, 2007 Author Share Posted April 13, 2007 Thanks for your reply! Yes, i do mean HTML formatting, sorry for not being clearer. This is a KB we have purchased from a company. Each question within the database can be formatted separately and differently. Looking at the API's they have supplied us, they give us an example: $_POST['answer'] = '<b>Hooray</b> we have added a question!'; My code being: $_POST['answer'] = $_POST['textarea1'].$_POST['textarea2'].$_POST['textarea3']; Judging by this, i have to format the question before i $_POST it. However the text is in a textarea, which means i would have to convert that text to a variable to format it, and then post it? Can you $_POST a variable? Gah! Confusion strikes! Quote Link to comment Share on other sites More sharing options...
trq Posted April 13, 2007 Share Posted April 13, 2007 Sorry, but saving a value in the $_POST array, eg; $_POST['answer'] = '<b>Hooray</b> we have added a question!'; Makes little sense, and so does the comment... which means i would have to convert that text to a variable to format it $_POST['answer'] is a form of variable. I don't really understand your question. Id'e suggest contacting the company you bought the script from and either asking for your money back or some support / explinations. 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.