Jump to content

Recommended Posts

When creating sticky forms, I can get one textfield to work with apostrophes and another to work with double quotes, but neither of them works with both. Below is the script I wrote to illustrate the problem. The first script is the form, the second script echos the output on another page. The output page just links back to the first at which time the problem occurs. Any ideas on how to get a field to accept both apostrophes and double quotes?

 

-----------------------------

First script:

-----------------------------

<body>

Sticky Forms:

<form action="materialPreview2.php" method="post" name="enterName" target="_self" id="enterName">

  <p>This will retain double quotes, but NOT apostrophes. Try it:

      <input name="firstTextField" type="text" value='<?php echo @$_POST['firstTextField']; ?>'>

  </p>

  <p>This will retain apostrophes, but NOT double quotes. Try it:

    <input name="secondTextField" type="text" value="<?php echo @$_POST['secondTextField']; ?>">

    </p>

    <p>

    <input name="insert" type="submit" id="insert" value=" Insert ">

</p>

</form>

</body>

-----------------------------

Second script:

-----------------------------

<body>

<?php

$myVar = $_POST["firstTextField"];

$myVar2 = $_POST["secondTextField"];

echo "Is " . $myVar . " and " . $myVar2 . " really what you want to stick?";

echo "<br>";

?>

<form name="form1" method="post" action="materialInput2.php">

  <input type="hidden" name="firstTextField" value='<?php echo $myVar; ?>'>

  <input type="hidden" name="secondTextField" value="<?php echo $myVar2; ?>">

  <input type="submit" name="button2" id="button2" value=" Edit ">

</form>

</body>

Link to comment
https://forums.phpfreaks.com/topic/137490-sticky-forms/
Share on other sites

Quotes and any other characters that have meaning in HTML are rendered by the browser and affect what and how it displays information. If you do a "view source" of your pages in your browser, you will see that all the content is there. To output content to a browser that contains characters that have special meaning in HTML, use htmlentities

Link to comment
https://forums.phpfreaks.com/topic/137490-sticky-forms/#findComment-718570
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.