submit form

  • dheerhot
  • Novice
  • Novice
  • User avatar
  • Posts: 34

Post 3+ Months Ago

hey now i m in a big trouble, i m submitting a value of textarea form test1.html to test2.php & when i accept that value in textarea of test2.php then its format got changed i.e. it accepts extra slashes, following is my code of both files...

test1.html


Code: [ Select ]
<form action="test2.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
          <table width="47%" height="154" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td width="32%">Description</td>
              <td width="3%">:</td>
              <td width="65%"><textarea name="ta" cols="40" rows="3" id="ta"></textarea></td>
            </tr>
            <tr>
              <td><input type="submit" name="Submit" value="Submit" /></td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
          </table>
</form>
  1. <form action="test2.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
  2.           <table width="47%" height="154" border="0" cellpadding="0" cellspacing="0">
  3.             <tr>
  4.               <td width="32%">Description</td>
  5.               <td width="3%">:</td>
  6.               <td width="65%"><textarea name="ta" cols="40" rows="3" id="ta"></textarea></td>
  7.             </tr>
  8.             <tr>
  9.               <td><input type="submit" name="Submit" value="Submit" /></td>
  10.               <td>&nbsp;</td>
  11.               <td>&nbsp;</td>
  12.             </tr>
  13.           </table>
  14. </form>



test2.php

Code: [ Select ]
<form id="form1" name="form1" method="post" action="">
  <textarea name="textarea" cols="60" rows="5"><?php echo $_POST['ta'];?></textarea>
</form>
  1. <form id="form1" name="form1" method="post" action="">
  2.   <textarea name="textarea" cols="60" rows="5"><?php echo $_POST['ta'];?></textarea>
  3. </form>


the output it shows in test2.php is...

Quote:
<img src=\"showing/m1.jpg\" alt=\"\" border=\"0\" />


actual output should be...

Quote:
<img src="showing/m1.jpg" alt="" border="0" />
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8388
  • Loc: USA

Post 3+ Months Ago

Try:
PHP Code: [ Select ]
<?php
$text = stripslashes($_POST['ta']);
// Do other stuff with $text like echo it to a textarea
?>
  1. <?php
  2. $text = stripslashes($_POST['ta']);
  3. // Do other stuff with $text like echo it to a textarea
  4. ?>


SIDE-NOTE: A short PHP form to echo a simple singular variable is <?=$text;?> that is the same as writing <?php echo $text; ?>
  • dheerhot
  • Novice
  • Novice
  • User avatar
  • Posts: 34

Post 3+ Months Ago

ohh thanx bogey & tht note is awesome...

well yesterday i was crushing my mind to solve this problem & i got tht i have to "off" magic quotes, when i did it problem solved...

but this one is much better to use, bcoz its too short...

thanx again
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8388
  • Loc: USA

Post 3+ Months Ago

Yup. Your welcome. Glad to be of help :D

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 65 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.