?
Solved

Problem with the apostrophe '

Posted on 2006-07-06
9
Medium Priority
?
622 Views
Last Modified: 2013-12-13

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)
0
Comment
Question by:MaxDisk
  • 5
  • 4
9 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17054280
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";?>'>
0
 

Author Comment

by:MaxDisk
ID: 17054828
nope I tested them both but the resulted is Don\\ and Don\
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 440 total points
ID: 17054851
<input type="text" name="T1" size="40" value="<?php  echo "Don't Know";?>" >
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:MaxDisk
ID: 17055025
oops
still more problem

Strange after I submited the form and recall the value the value getting strange here
still Don\\
0
 

Author Comment

by:MaxDisk
ID: 17055054

<?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
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17056123

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

Author Comment

by:MaxDisk
ID: 17075840
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.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17077173
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>
0
 

Author Comment

by:MaxDisk
ID: 17082463
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;
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month16 days, 15 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question