Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Problem with the apostrophe '

Posted on 2006-07-06
9
609 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 110 total points
ID: 17054851
<input type="text" name="T1" size="40" value="<?php  echo "Don't Know";?>" >
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
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…

856 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