开发者

Form value field is visable in localhost but not on live site-how to hide?

I'm almost completed moving my first live site to my new xampp setup on localhost.

I have a form that uses jquery in the header of the site.

It's a bit verbose, but here it is:

<div class="outeremailcontainer">
    <div id="emailcontainer">
  <?php include('verify.php'); ?>
      <form action="index_success.php" method="post" id="sendEmail" class="email">
        <h3 class="register2">Newsletter Signup:</h3>
        <ul class="forms email">
         <li class="name"><label for="yourName">Name: </label>
     <input type="text" name="yourName" class="info" id="yourName" value="<?= $_POST['yourName']; ?>" /><br />
    </li>

    <li class="city"><label for="yourCity">City: </label>
     <input type="text" name="yourCity" class="info" id="yourCity" value="<?= $_POST['yourCity']; ?>" /><br />
    </li>

          <li class="email"><label for="emailFrom">Email: </label>
             <input type="text" name="emailFrom" class="info" id="emailFrom" value="<?= $_POST['emailFrom']; ?>" />
             <?php if(isset($emailFromError)) echo '<span class="error">'.$emailFromError.'</span>';
             ?>
          </li>

           <li class="buttons email">
             <button type="submit" id="submit">Send</button>
             <input type="hidden" name="submitted" id="submitted" value="true" />
           </li>

        </ul>
      </form>
    <div class="clearing">
  </div>
  </div>
</div>

So I am using jQuery (I can include the function if need-be) and it hides fields, etc.

The problem is that on the localhost site, the values of the fields are populating the fields.

IE: first field has this in the box, etc

<?= $_POST['y开发者_如何学运维ourName']; ?>

It works great in the live site though.

Any idea how to fix this? Thanks!


If I understand you correctly, you are seeing the PHP code in the input box rather than the result of the form field value previously posted.

Check your php.ini file. I'm not much of a PHP programmer, but I believe there is a setting in there to allow the <?= shortcut. I think it's

short_open_tag = 1

That may be the reason you see the PHP code in the input box.

Alternatively, you could turn on asp_tags and use the <%= %> notation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜