views:

24

answers:

1

Hi guys, 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['yourName']; ?>

It works great in the live site though.

Any idea how to fix this? Thanks!

+1  A: 

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.

BradBrening
Hey-awesome-that was it. I actually just changed the fields to <?php echo ... and they work now. Thanks again!
Joel
You're welcome. Thanks for the quick accept and good luck!
BradBrening