PHP settings for a sticky form to work

Posted on 2009-02-11
Last Modified: 2012-05-06
I just set up wampserver to test my code before uploading to the group server and the only thing that is wrong isnt causing errors but is bothering me.

I have a bunch of sticky forms on different pages and they work on the group server but not on my localhost.  The pages do not error out but I do not get the sticky value, instead I always get code in the text this

<? if(isset($_POST['username'])) echo $_POST['username'];?>

like I said the code on the page works on the group server but not on localhost that was set up by wampserver.  

does anyone know what setting PHP is missing that has it display the code and not the value?

<!-- username field --> 

                <td width="140">Enter your username:</td>

                <td width="140"><input id="username" name="username" type="text" size="20" onBlur="validUsername(this, document.getElementById('username_help'))" value="<? if(isset($_POST['username'])) echo $_POST['username'];?>" /></td>

Open in new window

Question by:cybercookie72
    LVL 39

    Accepted Solution

    Use complete <?php start tag, or enable "short_open_tags" in php.ini:

    <?php if(isset($_POST['username'])) echo $_POST['username'];?>
    LVL 107

    Expert Comment

    by:Ray Paseur
    It's a common error, and I'll bet cxr is right about how to fix it.

    Going forward, you can use the code snippet to see your PHP values.  Compare the differences between the two systems and you'll never be surprised!

    Best to all, ~Ray
    <?php phpinfo(); ?>

    Open in new window


    Author Closing Comment

    You are AWESOME!!!!! thank you sooooo much!!  This has been bothering me ...A LOT.  thanks again

    Featured Post

    Easy Project Management (No User Manual Required)

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    This is a general how to create your own custom plugin system for your PHP application that you designed (or wish to extend a third party program to have plugin functionality that doesn't have it yet).  This is not how to make plugins for existing s…
    Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
    The viewer will learn how to dynamically set the form action using jQuery.
    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 …

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now