[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Problem with the apostrophe '

Posted on 2006-07-06
9
Medium Priority
?
617 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
[X]
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
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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

650 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