Page 1 of 1
textarea in php
Posted: Fri Feb 06, 2009 12:01 pm
by dheeraj
hello i m a newbie in php & i m crushing my mind in textarea, i want to submit value of textarea to another page, but when i send it its format got change my code is like a below one
Code: Select all
<form id="form1" name="form1" method="post" action="test2.php">
<textarea name="ta" cols="60" rows="6" id="ta"><p align="justify"></textarea>
<input type="submit" name="Submit" value="Submit" />
</form>
test2.php
Code: Select all
<textarea name="textarea" cols="60" rows="6"><?php echo $_POST['ta'];?></textarea>
its output should come as <p align="justify">
but its coming <p align=/"justify/">
so plz help me...
Re: textarea in php
Posted: Fri Feb 06, 2009 12:05 pm
by mickeyunderscore
You probably have magic_quotes enabled:
http://uk2.php.net/magic_quotes
You should disable it, or run stripslashes() on your $_POST variable e.g.:
Code: Select all
<?php echo stripslashes($_POST['ta']);?>
Re: textarea in php
Posted: Fri Feb 06, 2009 1:28 pm
by dheeraj
ohhhhhhh really thank u, thank u very much both options hd worked..
thank u...
there is one more problem ....
i want a combo box having values 1, 2 & 3 & having item label india, usa & england like below
Code: Select all
<select name="select">
<option value="1">india</option>
<option value="2">usa</option>
<option value="3">england</option>
now the question is tht how to retrive values & item label both at another page..
if i put
then the output will be 1, 2 or may be 3 depend on selection, but if i want item label thn wht to do....
Re: textarea in php
Posted: Fri Feb 06, 2009 1:32 pm
by mickeyunderscore
You can't retrieve the label via $_POST, only the value. You would need to change your select box code to:
Code: Select all
<option value="india">india</option>
<option value="usa">usa</option>
<option value="england">england</option>
Re: textarea in php
Posted: Fri Feb 06, 2009 1:42 pm
by dheeraj
okkkkk again thanx ur help is apreciable...
Re: textarea in php
Posted: Fri Feb 06, 2009 1:49 pm
by Benjamin
Forum Rules wrote:
11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.
viewtopic.php?f=6&t=30037