Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
|
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 30th, 2008, 12:44 AM
Registered User
 
Join Date: Dec 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Question PHP5 is not passing form values from input variables

Hi,

I am working with PHP5 and I am not able to even pass values from an HTML form to a php script. The crazy part about this condition is the other day it was working fine. I have apache 2.2, and php5 installed on my notebook and also I have turned on the register_globals to equal on in the php.ini file.

Also, I am doing this with an HTML page using a form input variable that gets a php script and the php script should be able to read the variable that I create in the HTML page.


It is a very simple HTML form and php script:

<HTML>
<HEAD></HEAD>
<BODY>
<FORM METHOD=POST ACTION="checkbox.php">
Have you eaten shrimp before?
<INPUT NAME="Choice" TYPE="Checkbox">
<BR>
<BR>
<INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>
------------------------------------------------------------------
(PHP SCRIPT)

<HTML>
<HEAD></HEAD>
<BODY>
<?php
echo $Choice;
?>
</BODY>
</HTML>

I do not know if this is php or windows causing this problem.

I just need to get this to work on my notebook so I can write some php scripts and test the scripts locally on the notebook.

Any help is appreciated.
 
Old December 30th, 2008, 03:35 AM
Authorized User
 
Join Date: Dec 2008
Posts: 50
Thanks: 1
Thanked 5 Times in 5 Posts
Default

try the following code plz.

Code:
<html>
    <head>HTML Page</head>
    <body>
        <form method="post" action="checkbox.php">
            have you eaten shrimp before?
            <input type="checkbox" name="choice"  />
            <br>
            <br>
            <input type="submit" name="action" value="Submit">
        </form>
    </body>
</html>
Code:
<html>
    <head>PHP File(checkbox.php)</head>
    <body>
        <pre>
        <?php
            echo $_POST['choice'];
            echo "\n";
            print_r($_POST);
            echo "\n";
            print_r($_GET);
        ?>
        </pre>
    </body>
</html>
thanks
 
Old December 30th, 2008, 02:30 PM
Registered User
 
Join Date: Dec 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb Upgraded PHP

I appreciate the script and thank you very much.

I also went ahead and upgraded the php and got it working on the old code as well now.

Thank You...





Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP5 is not passing form values from input variables sjfoglia Beginning PHP 1 December 30th, 2008 02:24 PM
Passing Input Date Parameter values preethig Crystal Reports 0 February 28th, 2008 08:39 AM
Passing variables from 1 form to another. jainin_shah9 C# 10 February 18th, 2008 07:59 PM
passing values and variables anshul Javascript How-To 3 July 26th, 2004 02:30 PM
Clearing values from form and ASP variables sniffer Classic ASP Basics 1 September 24th, 2003 02:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.