By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,960 Members | 1,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,960 IT Pros & Developers. It's quick & easy.

text area used to edit homepage

P: 1
A php newbie with a problem!

I have a form with a text area

<form name=edit_front_page_form action="/test.php?page=front_page_updated" method=get>
<p>Edit front page<br>
<textarea cols=30 rows=15 name='text_front_page'></textarea>
<input type=submit value="Submit">

It is blank initially - the user can enter html text e.g.
<p> Welcome to the homepage<p>

I want to save this to a mysql db. I also want to retrieve it from the db and display it when a user accesses the homepage.

I am using php. However when I submit the form using a 'get' the text field is not sent properly

i.e. "http://localhost/XYZ.php?text_front_page=%3Cp%3EWelcome+to+the+home page%3E%0D%0A" is the request message...

Any help would be great...
Jun 19 '06 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 8,916
Actually that is correct some characters are not valid in a URL, like space. To get round this they are converted to there ASCII code and the character is replaced with %<ASCIICodeInHex>, spaces are replaced with + (not quite sure what it would do with a + probably replace with ascii code.

So in the sur you provided

http://localhost/XYZ.php? page%3E%0D%0A

You have the following

%3C ASCII Code for <
%3E ASCII Code for >
%0D ASCII code for carridge return
%0A ASCII code for new line
+ replaces space


http://localhost/XYZ.php?text_front_page=<p>Welcome to the home page>

And this is what php will receive.

Of course having decoded it a realise that you may be talking about the end of this line where you have > instead of </p>

I have to say that subbmitting html like that works on a site I run but I use the POST method rather than the GET method.
Jun 30 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.