PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
davidklonski
Forum Contributor
Posts: 128 Joined: Mon Mar 22, 2004 4:55 pm
Post
by davidklonski » Wed Apr 14, 2004 6:40 pm
hi
I wrote this simple test program in file test.php:
Code: Select all
<?php
$arr = array_keys($_GET);
foreach ($arr as $key) {
print $key . "<br>";
}
?>
<html>
<body>
<form name="entry" method="GET" action="test.php">
<input type="text" name="TX">
<input type="checkbox" name="CH">
<input type="submit">
<input type="hidden" name="HD">
</form>
</body>
</html>
for some reason the checkbox is not being displayed as part of the $_GET array.
This is probably some stupid mistake on my part.
can anyone see it?
thanks in advance
markl999
DevNet Resident
Posts: 1972 Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)
Post
by markl999 » Wed Apr 14, 2004 6:51 pm
I can't reproduce it here, your script seems to work ok *shrug*
RadixDev
Forum Commoner
Posts: 66 Joined: Sun Mar 14, 2004 11:27 am
Location: U.K.
Post
by RadixDev » Wed Apr 14, 2004 6:58 pm
What happens if you put a value to the checkbox?
davidklonski
Forum Contributor
Posts: 128 Joined: Mon Mar 22, 2004 4:55 pm
Post
by davidklonski » Wed Apr 14, 2004 7:02 pm
nothing new, the output is:
TX
HD
Paddy
Forum Contributor
Posts: 244 Joined: Wed Jun 11, 2003 8:16 pm
Location: Hobart, Tas, Aussie
Contact:
Post
by Paddy » Wed Apr 14, 2004 7:30 pm
<input type="checkbox" name="CH[]">
Put an array value in there.
davidklonski
Forum Contributor
Posts: 128 Joined: Mon Mar 22, 2004 4:55 pm
Post
by davidklonski » Thu Apr 15, 2004 3:49 am
I did but still no checkbox...
It is as if the checkbox is not a part of the form
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Thu Apr 15, 2004 4:11 am
you need to give the checkbox a value!
Code: Select all
<input type="checkbox" name="CH" value="checked">
The checkbox will ONLY appear if you have checked the check box
Mark
RadixDev
Forum Commoner
Posts: 66 Joined: Sun Mar 14, 2004 11:27 am
Location: U.K.
Post
by RadixDev » Thu Apr 15, 2004 4:53 am
Bech100:-
RadixDev wrote: What happens if you put a value to the checkbox?
and he says:-
davidklonski wrote: I did but still no checkbox...
It is as if the checkbox is not a part of the form
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Thu Apr 15, 2004 5:10 am
yeah, i saw that, but i am guessing, when you told him to put a value in, he just checked the box and didn't change the code. Thats why i actually gave code to confirm this.
When typing a reply, in your head you know what YOU mean, but someone reading it can interpret in an entirely different way.
Mark