Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning 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 November 7th, 2003, 09:44 PM
Authorized User
 
Join Date: Oct 2003
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can't display values of HTML form controls

I have problem displaying values for radio button, text, checkbox and others.
I followed exactly the code in the Beginning PHP4 but i can't display the selected values.
I'm lost. Please help.
Below are the example one of the source code and displays of my page.

//for radio.html
<HTML>
<HEAD></HEAD>
<BODY>
<FORM METHOD=GET ACTION="radio.php">
What is the capital of Portugal?
<BR>
<BR>
<INPUT NAME="Question1" TYPE="Radio" VALUE="Porto">
Porto

<BR>
<INPUT NAME="Question1" TYPE="Radio" VALUE="Lisbon">
Lisbon

<BR>
<INPUT NAME="Question1" TYPE="Radio" VALUE="Madrid">
Madrid

<BR>
<BR>
<INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>

//for radio.php
<HTML>
<HEAD></HEAD>
<BODY>
<?php
echo "You selected the answer: $Question1";
?>
</BODY>
</HTML>


No matter which option i choose, the display will always be :

You selected the answer:

I think it's not because of the code right? is it because of some settings of my pc?

 
Old November 8th, 2003, 10:21 AM
Authorized User
 
Join Date: Oct 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to phpsharma Send a message via Yahoo to phpsharma
Default

please use $_GET["Question1"]

Things have been changed.. please look into manual at www.php.net
bye
take care
Since PHP 4.1.0, the preferred method for retrieving external variables is with the superglobals mentioned below. Before this time, people relied on either register_globals or the long predefined PHP arrays ($HTTP_*_VARS). As of PHP 5.0.0, the long PHP predefined variable arrays may be disabled with the register_long_arrays directive.

HTTP GET variables: $_GET
Note: Introduced in 4.1.0. In earlier versions, use $HTTP_GET_VARS.

An associative array of variables passed to the current script via the HTTP GET method. Automatically global in any scope.

This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $_GET; to access it within functions or methods, as you do with $HTTP_GET_VARS.

$HTTP_GET_VARS contains the same initial information, but is not an autoglobal. (Note that HTTP_GET_VARS and $_GET are different variables and that PHP handles them as such)

If the register_globals directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the $_GET and $HTTP_GET_VARS arrays. For related information, see the security chapter titled Using Register Globals. These individual globals are not autoglobal




God Knows better than US
 
Old November 8th, 2003, 04:10 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

More info:
  http://p2p.wrox.com/archive/beginnin...2002-11/17.asp
  http://www.google.com/search?q=site:...ster%5Fglobals


Take care,

Nik
http://www.bigaction.org/
 
Old November 10th, 2003, 05:34 AM
Authorized User
 
Join Date: Oct 2003
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default

THANKS! i can now display the values and know more about php by reading the links given.






Similar Threads
Thread Thread Starter Forum Replies Last Post
JSP code to insert values from HTML form to SQL se rbyamukama Pro JSP 3 January 29th, 2013 07:42 AM
HTML controls g_vamsi_krish ASP.NET 1.0 and 1.1 Professional 7 January 10th, 2006 02:14 AM
HTML Controls rajanikrishna General .NET 1 November 10th, 2004 11:35 AM
Access HTML form values in a VB DLL madhukp Pro VB 6 2 July 25th, 2004 11:58 PM





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