Help - Search - Members - Calendar
Full Version: php not displaying
HTMLHelp Forums > Programming > Server-side Scripting
Gooo
Hi

I've never worked with php before, and not really sure why its not working.

When I fill in the form and submit it, the only thing that displays is:
Welcome .
Why isn't the name displayed?

My process.php code:
CODE
<html>
<body>
Welcome <?php echo $_GET["name"]; ?>.<br />
</body>
</html>


My index.html code:
CODE
<html>
<body>
    <form method="get" action="process.php">
        <table cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td> Please fill in the form below  </td>
            </tr>
            <tr valign="top">
                <td> Name </td>
                <td> <input type="text" name="name" size="20" maxlength="100" /> </td>
            </tr>
        </table>
    </form>
</body>
</html>



Thanks
pandy
Is the page parsed for PHP at all? View Source. If you can still see the PHP code, it isn't. Are you sure PHP is available to you on the server where you are hosted?
Frederiek
Works for me, in my localhost.

PHP 101: PHP For the Absolute Beginner
Gooo
QUOTE(pandy @ Jul 30 2009, 12:28 AM) *

Is the page parsed for PHP at all? View Source. If you can still see the PHP code, it isn't. Are you sure PHP is available to you on the server where you are hosted?


I didn’t realize I had to put my index.html and process.php in C:xampp/htdocs.

Everything is working perfect now. Thank you.

I've just got one more question.
On my index.html page I have a form with 3 checkboxes.
CODE
<input type="checkbox" name="number" value="one" /> 1
<br />
<input type="checkbox" name=" number " value="two" /> 2
<br />
<input type="checkbox" name=" number " value="three" /> 3


How can I display the different options that were selected on my process.php (i.e. if the user selects the first and third option, the process.php must display - one, three )
Christian J
QUOTE(Gooo @ Jul 30 2009, 01:01 PM) *

I've just got one more question.
On my index.html page I have a form with 3 checkboxes.
CODE
<input type="checkbox" name="number" value="one" /> 1
<br />
<input type="checkbox" name=" number " value="two" /> 2
<br />
<input type="checkbox" name=" number " value="three" /> 3


How can I display the different options that were selected on my process.php (i.e. if the user selects the first and third option, the process.php must display - one, three )

You need to add square brackets in the names, see http://www.php.net/manual/en/faq.html.php#faq.html.arrays

Then you can e.g. loop through the resulting array and see if each box was checked with isset().
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.