Jump to content

More $_POST fun!


rhyspaterson

Recommended Posts

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

Link to comment
Share on other sites

"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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.