Link to home
Start Free TrialLog in
Avatar of MaxDisk
MaxDisk

asked on

Problem with the apostrophe '


I try to display the message in the text box with php but it stop at the '

<input type="text" name="T1" size="40" value='<?php  echo "Don\'t Know";?>'>

Only output Don, i like to be able to display the ' (apostrophe)
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

note sure, but one of the following should work:
<input type="text" name="T1" size="40" value='<?php  echo "Don\\\'t Know";?>'>
<input type="text" name="T1" size="40" value='<?php  echo "Don\'\'t Know";?>'>
Avatar of MaxDisk
MaxDisk

ASKER

nope I tested them both but the resulted is Don\\ and Don\
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MaxDisk

ASKER

oops
still more problem

Strange after I submited the form and recall the value the value getting strange here
still Don\\
Avatar of MaxDisk

ASKER


<?php if(isset($_POST['T1'])) { echo $_POST['T1'];} ?>

the result Don't after first submit
                Do\\ after 2nd sumit
               Do\\\\\\\\\ and goes on and on

<?php if(isset($_POST['T1'])) { echo stripslashes($_POST['T1']) ;} ?>
Avatar of MaxDisk

ASKER

Nope still not working.

The result is just DON

<input type="text" name="'T1" size="40" value='<?php if(isset($_POST[''T1'])) { echo stripslashes($_POST[''T1']) ;} ?>'>

The result is just DON
not Don't Know.
here is my test form, which worked perfectly:

<form action="" method="post">
<input type="text" name="T1" size="40" value="<?php if(isset($_POST['T1'])) { echo stripslashes($_POST['T1']) ;} ?>"></input>
<button type="submit"></button>
</form>
Avatar of MaxDisk

ASKER

thank you for the following this problem.
seems like it's working fine now.

I will post the message if I see any more problem.

The below is the working version.
Thank you every much.


//form Test_Opostrophe.php <p>
Normal echo>>>>
<?php if(isset($_POST['T1'])) { echo stripslashes($_POST['T1']) ;} ?>

<form method="POST" action="Test_Opostrophe_submit.php">
Enter something with the backslash, the script will display all of the backslash perfectly now.
<br>
Notes if... wanted to pre-enter text within the text box or assign the string remember to put the backslash in font of the opostrope


<input type="text" name="T1" size="40" value="<?php if(isset($_POST['T1'])) { echo stripslashes($_POST['T1']) ;} ?>"></input>
<input type="submit" value="Submit" name="B1">
</form>
<p>&nbsp;</p>


//form Test_Opostrophe_Submit.php<p>

<form method="POST" action="Test_Opostrophe.php">

Normal echo >>>>>

<?php if(isset($_POST['T1'])) { echo stripslashes($_POST['T1']) ;} ?>

&nbsp;<p>Echo within the textbox</p>
<input type="text" name="T1" size="40" value="<?php if(isset($_POST['T1'])) { echo stripslashes($_POST['T1']) ;} ?>"></input>
<input type="submit" value="Submit" name="B1"></form><BR>
&nbsp;