Solved

Problem with the apostrophe '

Posted on 2006-07-06
9
603 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 142

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 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 110 total points
ID: 17054851
<input type="text" name="T1" size="40" value="<?php  echo "Don't Know";?>" >
0
 

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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

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 142

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 142

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now