473,715 Members | 2,207 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form and radio buttons; can't send them correctly

Hi,

Newbie to PHP here, no C or other relevant background, so pretty niave
w/r to the nuances etc. but I think this is pretty basic.

XP Pro, SP2+, PHP 4.4.7, XAMPP Local Apache Server 6.something I think
and running as a service, Using NoteTab Pro as an IDE (works well). If
you need more, just ask.

In one functioning form:
I have a radio button with 3 choices, Yes, No, Don't Care. It works
fine.

In the *problem* form I have a radio button category with 11 choices:
Ratings from 0 to 10.

If *no* button is clicked, I get the expected "" echoed on
Submitting. Seems fine.

But if *any* of the 11 buttons are clicked (ticked), I only get *
"on" * instead of the digits I expect. I have NO idea where the "on"
comes from, nor why one form works and one doesn't; they are as
reasonably identical as possible and no amount of fiddling will seem to
change echoing the "on" instead of the "x" value I expect. It's as
though if anything is checked, it gives the message "on", but the
working form mentioned above does not do that.

I can post more, or full code, if you ask, but I don't think you want to
dig thru all that. Here are what I think are the relevant parts of the
code. I'm open to any all all advice, including providing more code if
it'll help anything. I do have a web site I can put it on for download.
None of this has been uploaded to a real site yet, but ... I'm
running the exact same local Apache & PHP as is on the web site. I have
not switched to PHP 5 yet.
Below are all EXACT pastes, not hand typed & not touched otherwise:

From the Working Form:
In Main part:
------------
<Div class = "radio">
Would you like a resonse? &nbsp &nbsp
<input type="radio" name="respond" value="Yes">Yes -
<input type="radio" name="respond" value="No">No -
<input type="radio" name="respond" value="Don't Care"It does not
matter <br><br>
value="<?php if(isset($_POST['respond'])){echo $_POST['respond'];} ?>"
/></div>
[ NOTE I have no idea what the "/>" is or does but it doesn't
seem to care whether it's there or not! It came from
some code I scraped somwhere along the line ]

---------------
and in the result.php;
....
if(isset($post['respond'])){$_respond = $post['respond'];}else{$_respon d
= '';}
....
....
echo "Respond? <br\"" . $_respond . "\" <br><br>";
....
$mail_body = '
..
Respond: '. $_respond . '<br>
....

As I said, that all works fine.
=============== ========
In the PROBLEM form (diff var name):
In Main Part:
-------------------
<Div class = "radio">
Item/s purchased: &nbsp &nbsp
<input type="radio" name="item" <value = "0">0
<input type="radio" name="item" <value = "1">1
<input type="radio" name="item" <value = "2"2
<input type="radio" name="item" <value = "3"3
<input type="radio" name="item" <value = "4"4
<input type="radio" name="item" <value = "5"5
<input type="radio" name="item" <value = "6"6
<input type="radio" name="item" <value = "7"7
<input type="radio" name="item" <value = "8"8
<input type="radio" name="item" <value = "9"9
<input type="radio" name="item" <value = "10"10
<value = "<?php if(isset($_POST['item'])){echo $_POST['item'];} ?>"
</div>
------------------

And the result.php:
....
if(isset($post['item'])){$_item = $post['item'];}else{$_item = '';}
....
echo "Item Rating: <br\"" . $_item . "\" <br><br>";
....
$mail_body = '
..
item: '. $_item .' <br>
....
============

As I said, ticking any one of those items gives me "on" when the value
is echoed to the screen instead of the expected digit character. The
radio buttons function correctly on the form; only once can be checked,
etc..

Any hints/assistance/advice very much appreciated,

TIA,

Twayne


Jun 27 '08 #1
11 2274
On Mon, 02 Jun 2008 20:06:35 +0200, Twayne <no****@devnull .spamcop.net
wrote:
Newbie to PHP here, no C or other relevant background, so pretty niave
w/r to the nuances etc. but I think this is pretty basic.

XP Pro, SP2+, PHP 4.4.7, XAMPP Local Apache Server 6.something I think
and running as a service, Using NoteTab Pro as an IDE (works well). If
you need more, just ask.

In one functioning form:
I have a radio button with 3 choices, Yes, No, Don't Care. It works
fine.

In the *problem* form I have a radio button category with 11 choices:
Ratings from 0 to 10.

If *no* button is clicked, I get the expected "" echoed on
Submitting. Seems fine.

But if *any* of the 11 buttons are clicked (ticked), I only get *
"on" * instead of the digits I expect.
Below are all EXACT pastes, not hand typed & not touched otherwise:
<input type="radio" name="item" <value = "0">0
You HTML is broken, always validate you pages (http://validator.w3.org),
it would have told you almost instantly you inputs were malformed (which
saves you a lot of time).

In case you don't notice: lose the extra < before value:
<input type="radio" name="item" value="0">
--
Rik Wasmus
....spamrun finished
Jun 27 '08 #2
Twayne wrote:
Hi,

Newbie to PHP here, no C or other relevant background, so pretty niave
w/r to the nuances etc. but I think this is pretty basic.

XP Pro, SP2+, PHP 4.4.7, XAMPP Local Apache Server 6.something I think
and running as a service, Using NoteTab Pro as an IDE (works well). If
you need more, just ask.

In one functioning form:
I have a radio button with 3 choices, Yes, No, Don't Care. It works
fine.

In the *problem* form I have a radio button category with 11 choices:
Ratings from 0 to 10.

If *no* button is clicked, I get the expected "" echoed on
Submitting. Seems fine.

But if *any* of the 11 buttons are clicked (ticked), I only get *
"on" * instead of the digits I expect. I have NO idea where the "on"
comes from, nor why one form works and one doesn't; they are as
reasonably identical as possible and no amount of fiddling will seem to
change echoing the "on" instead of the "x" value I expect. It's as
though if anything is checked, it gives the message "on", but the
working form mentioned above does not do that.

I can post more, or full code, if you ask, but I don't think you want to
dig thru all that. Here are what I think are the relevant parts of the
code. I'm open to any all all advice, including providing more code if
it'll help anything. I do have a web site I can put it on for download.
None of this has been uploaded to a real site yet, but ... I'm
running the exact same local Apache & PHP as is on the web site. I have
not switched to PHP 5 yet.
Below are all EXACT pastes, not hand typed & not touched otherwise:

From the Working Form:
In Main part:
------------
<Div class = "radio">
Would you like a resonse? &nbsp &nbsp
<input type="radio" name="respond" value="Yes">Yes -
<input type="radio" name="respond" value="No">No -
<input type="radio" name="respond" value="Don't Care"It does not
matter <br><br>
value="<?php if(isset($_POST['respond'])){echo $_POST['respond'];} ?>"
/></div>
[ NOTE I have no idea what the "/>" is or does but it doesn't
seem to care whether it's there or not! It came from
some code I scraped somwhere along the line ]

---------------
and in the result.php;
...
if(isset($post['respond'])){$_respond = $post['respond'];}else{$_respon d
= '';}
...
...
echo "Respond? <br\"" . $_respond . "\" <br><br>";
...
$mail_body = '
.
Respond: '. $_respond . '<br>
...

As I said, that all works fine.
=============== ========
In the PROBLEM form (diff var name):
In Main Part:
-------------------
<Div class = "radio">
Item/s purchased: &nbsp &nbsp
<input type="radio" name="item" <value = "0">0
<input type="radio" name="item" <value = "1">1
<input type="radio" name="item" <value = "2"2
<input type="radio" name="item" <value = "3"3
<input type="radio" name="item" <value = "4"4
<input type="radio" name="item" <value = "5"5
<input type="radio" name="item" <value = "6"6
<input type="radio" name="item" <value = "7"7
<input type="radio" name="item" <value = "8"8
<input type="radio" name="item" <value = "9"9
<input type="radio" name="item" <value = "10"10
<value = "<?php if(isset($_POST['item'])){echo $_POST['item'];} ?>"
</div>
------------------

And the result.php:
...
if(isset($post['item'])){$_item = $post['item'];}else{$_item = '';}
...
echo "Item Rating: <br\"" . $_item . "\" <br><br>";
...
$mail_body = '
.
item: '. $_item .' <br>
...
============

As I said, ticking any one of those items gives me "on" when the value
is echoed to the screen instead of the expected digit character. The
radio buttons function correctly on the form; only once can be checked,
etc..

Any hints/assistance/advice very much appreciated,

TIA,

Twayne

In addition to what Rik said - it is $_POST['item'], not $post['item'].

And before you learn PHP, you need some understanding of HTML. If you
don't have correct HTML, there is nothing you can do in PHP to make
things work.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 27 '08 #3
On Mon, 02 Jun 2008 20:06:35 +0200, Twayne
<no****@devnull .spamcop.netwro te:
>Newbie to PHP here, no C or other relevant background, so pretty
niave w/r to the nuances etc. but I think this is pretty basic.

XP Pro, SP2+, PHP 4.4.7, XAMPP Local Apache Server 6.something I
think and running as a service, Using NoteTab Pro as an IDE (works
well). If you need more, just ask.

In one functioning form:
I have a radio button with 3 choices, Yes, No, Don't Care. It
works fine.

In the *problem* form I have a radio button category with 11 choices:
Ratings from 0 to 10.

If *no* button is clicked, I get the expected "" echoed on
Submitting. Seems fine.

But if *any* of the 11 buttons are clicked (ticked), I only get *
"on" * instead of the digits I expect.
>Below are all EXACT pastes, not hand typed & not touched otherwise:
><input type="radio" name="item" <value = "0">0

You HTML is broken, always validate you pages
(http://validator.w3.org), it would have told you almost instantly
you inputs were malformed (which saves you a lot of time).

In case you don't notice: lose the extra < before value:
<input type="radio" name="item" value="0">
GAK! Thanks, Ric! Looks like I bungled a Search & Destroy somewhere
along the line. I did do a few "desparate" moves out of frustration;
thought I'd fixed it all after a coffee-break.

Thanks!
Jun 27 '08 #4
WARNING: A very thick-skulled, occasionally myopic OP bottom posted a
response to Jerry:
Twayne wrote:
>Hi,

Newbie to PHP here, no C or other relevant background, so pretty
niave w/r to the nuances etc. but I think this is pretty basic.

XP Pro, SP2+, PHP 4.4.7, XAMPP Local Apache Server 6.something I
think and running as a service, Using NoteTab Pro as an IDE (works
well). If you need more, just ask.
....
>Below are all EXACT pastes, not hand typed & not touched otherwise:

From the Working Form:
In Main part:
------------
<Div class = "radio">
Would you like a resonse? &nbsp &nbsp
<input type="radio" name="respond" value="Yes">Yes -
<input type="radio" name="respond" value="No">No -
<input type="radio" name="respond" value="Don't Care"It does not
matter <br><br>
value="<?php if(isset($_POST['respond'])){echo $_POST['respond'];}
?>" /></div>
[ NOTE I have no idea what the "/>" is or does but it
doesn't seem to care whether it's there or not! It came from
some code I scraped somwhere along the line ]

---------------
and in the result.php;
...
if(isset($po st['respond'])){$_respond =
$post['respond'];}else{$_respon d = '';}
...
...
echo "Respond? <br\"" . $_respond . "\" <br><br>";
...
$mail_body = '
.
Respond: '. $_respond . '<br>
...

As I said, that all works fine.
============== =========
In the PROBLEM form (diff var name):
In Main Part:
-------------------
<Div class = "radio">
Item/s purchased: &nbsp &nbsp
<input type="radio" name="item" <value = "0">0
<input type="radio" name="item" <value = "1">1
<input type="radio" name="item" <value = "2"2
<input type="radio" name="item" <value = "3"3
<input type="radio" name="item" <value = "4"4
<input type="radio" name="item" <value = "5"5
<input type="radio" name="item" <value = "6"6
<input type="radio" name="item" <value = "7"7
<input type="radio" name="item" <value = "8"8
<input type="radio" name="item" <value = "9"9
<input type="radio" name="item" <value = "10"10
<value = "<?php if(isset($_POST['item'])){echo $_POST['item'];} ?>"
</div>
------------------

And the result.php:
...
if(isset($po st['item'])){$_item = $post['item'];}else{$_item = '';}
...
echo "Item Rating: <br\"" . $_item . "\" <br><br>";
...
$mail_body = '
.
item: '. $_item .' <br>
...
============
....
>>

In addition to what Rik said - it is $_POST['item'], not
$post['item'].
And before you learn PHP, you need some understanding of HTML. If you
don't have correct HTML, there is nothing you can do in PHP to make
things work.

Thanks, Jerry. The "<value" was an aberration of frustration, I think;
no other reason for it to be there. I'm no guru at HTML but I do know
better. I broke the lines up that way to keep them all onscreen without
having to scroll horizontally. It's gone and a new ZIP made<g>. Poor
houskeeping, I know.

I assume the '$post' you're talking about is here:
if(isset($post['item'])){$_item = $post['item'];}else{$_item = '';} ?

Making the '$post' to $_POST change was no help, BUT ... I think I have
to back up and get another head-around on this. I thought I'd figured
out what the syntax of all the line parts meant, but apparently I'm
still not getting it straight.

I'll let you know either way whether I get it working or have another
question.

Thanks much,

Twayne

Jun 27 '08 #5
Twayne wrote:
WARNING: A very thick-skulled, occasionally myopic OP bottom posted a
response to Jerry:
>Twayne wrote:
>>Hi,

Newbie to PHP here, no C or other relevant background, so pretty
niave w/r to the nuances etc. but I think this is pretty basic.

XP Pro, SP2+, PHP 4.4.7, XAMPP Local Apache Server 6.something I
think and running as a service, Using NoteTab Pro as an IDE (works
well). If you need more, just ask.
...
>>Below are all EXACT pastes, not hand typed & not touched otherwise:

From the Working Form:
In Main part:
------------
<Div class = "radio">
Would you like a resonse? &nbsp &nbsp
<input type="radio" name="respond" value="Yes">Yes -
<input type="radio" name="respond" value="No">No -
<input type="radio" name="respond" value="Don't Care"It does not
matter <br><br>
value="<?php if(isset($_POST['respond'])){echo $_POST['respond'];}
?>" /></div>
[ NOTE I have no idea what the "/>" is or does but it
doesn't seem to care whether it's there or not! It came from
some code I scraped somwhere along the line ]

---------------
and in the result.php;
...
if(isset($pos t['respond'])){$_respond =
$post['respond'];}else{$_respon d = '';}
...
...
echo "Respond? <br\"" . $_respond . "\" <br><br>";
...
$mail_body = '
.
Respond: '. $_respond . '<br>
...

As I said, that all works fine.
============= ==========
In the PROBLEM form (diff var name):
In Main Part:
-------------------
<Div class = "radio">
Item/s purchased: &nbsp &nbsp
<input type="radio" name="item" <value = "0">0
<input type="radio" name="item" <value = "1">1
<input type="radio" name="item" <value = "2"2
<input type="radio" name="item" <value = "3"3
<input type="radio" name="item" <value = "4"4
<input type="radio" name="item" <value = "5"5
<input type="radio" name="item" <value = "6"6
<input type="radio" name="item" <value = "7"7
<input type="radio" name="item" <value = "8"8
<input type="radio" name="item" <value = "9"9
<input type="radio" name="item" <value = "10"10
<value = "<?php if(isset($_POST['item'])){echo $_POST['item'];} ?>"
</div>
------------------

And the result.php:
...
if(isset($pos t['item'])){$_item = $post['item'];}else{$_item = '';}
...
echo "Item Rating: <br\"" . $_item . "\" <br><br>";
...
$mail_body = '
.
item: '. $_item .' <br>
...
=========== =
...
>In addition to what Rik said - it is $_POST['item'], not
$post['item'].
And before you learn PHP, you need some understanding of HTML. If you
don't have correct HTML, there is nothing you can do in PHP to make
things work.


Thanks, Jerry. The "<value" was an aberration of frustration, I think;
no other reason for it to be there. I'm no guru at HTML but I do know
better. I broke the lines up that way to keep them all onscreen without
having to scroll horizontally. It's gone and a new ZIP made<g>. Poor
houskeeping, I know.

I assume the '$post' you're talking about is here:
if(isset($post['item'])){$_item = $post['item'];}else{$_item = '';} ?

Making the '$post' to $_POST change was no help, BUT ... I think I have
to back up and get another head-around on this. I thought I'd figured
out what the syntax of all the line parts meant, but apparently I'm
still not getting it straight.

I'll let you know either way whether I get it working or have another
question.

Thanks much,

Twayne
Sorry, from your post it looked like you weren't familiar with HTML. We
sometimes get people here who don't understand HTML much (if at all),
and they complain because their PHP isn't working. When in reality the
problem is back in the HTML. And your error is very typical of the type
of error those people make.

If you are familiar with HTML, then my apologies.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 27 '08 #6
Twayne wrote:
>WARNING: A very thick-skulled, occasionally myopic OP bottom posted a
response to Jerry:
>>Twayne wrote:
Hi,

Newbie to PHP here, no C or other relevant background, so pretty
niave w/r to the nuances etc. but I think this is pretty basic.

XP Pro, SP2+, PHP 4.4.7, XAMPP Local Apache Server 6.something I
think and running as a service, Using NoteTab Pro as an IDE (works
well). If you need more, just ask.
...
>>>Below are all EXACT pastes, not hand typed & not touched otherwise:

From the Working Form:
In Main part:
------------
<Div class = "radio">
Would you like a resonse? &nbsp &nbsp
<input type="radio" name="respond" value="Yes">Yes -
<input type="radio" name="respond" value="No">No -
<input type="radio" name="respond" value="Don't Care"It does not
matter <br><br>
value="<?php if(isset($_POST['respond'])){echo $_POST['respond'];}
" /></div>
[ NOTE I have no idea what the "/>" is or does but it
doesn't seem to care whether it's there or not! It came from
some code I scraped somwhere along the line ]

---------------
and in the result.php;
...
if(isset($po st['respond'])){$_respond =
$post['respond'];}else{$_respon d = '';}
...
...
echo "Respond? <br\"" . $_respond . "\" <br><br>";
...
$mail_body = '
.
Respond: '. $_respond . '<br>
...

As I said, that all works fine.
============ ===========
In the PROBLEM form (diff var name):
In Main Part:
-------------------
<Div class = "radio">
Item/s purchased: &nbsp &nbsp
<input type="radio" name="item" <value = "0">0
<input type="radio" name="item" <value = "1">1
<input type="radio" name="item" <value = "2"2
<input type="radio" name="item" <value = "3"3
<input type="radio" name="item" <value = "4"4
<input type="radio" name="item" <value = "5"5
<input type="radio" name="item" <value = "6"6
<input type="radio" name="item" <value = "7"7
<input type="radio" name="item" <value = "8"8
<input type="radio" name="item" <value = "9"9
<input type="radio" name="item" <value = "10"10
<value = "<?php if(isset($_POST['item'])){echo $_POST['item'];} ?>"
</div>
------------------

And the result.php:
...
if(isset($po st['item'])){$_item = $post['item'];}else{$_item = '';}
...
echo "Item Rating: <br\"" . $_item . "\" <br><br>";
...
$mail_body = '
.
item: '. $_item .' <br>
...
========== ==
...
>>In addition to what Rik said - it is $_POST['item'], not
$post['item'].
And before you learn PHP, you need some understanding of HTML. If
you don't have correct HTML, there is nothing you can do in PHP to
make things work.


Thanks, Jerry. The "<value" was an aberration of frustration, I
think; no other reason for it to be there. I'm no guru at HTML but
I do know better. I broke the lines up that way to keep them all
onscreen without having to scroll horizontally. It's gone and a new
ZIP made<g>. Poor houskeeping, I know.

I assume the '$post' you're talking about is here:
if(isset($post['item'])){$_item = $post['item'];}else{$_item = '';}
?

Making the '$post' to $_POST change was no help, BUT ... I think I
have to back up and get another head-around on this. I thought I'd
figured out what the syntax of all the line parts meant, but
apparently I'm still not getting it straight.

I'll let you know either way whether I get it working or have another
question.

Thanks much,

Twayne

Sorry, from your post it looked like you weren't familiar with HTML.
We sometimes get people here who don't understand HTML much (if at
all), and they complain because their PHP isn't working. When in
reality the problem is back in the HTML. And your error is very
typical of the type of error those people make.

If you are familiar with HTML, then my apologies.


Hi,

AB-SO-LUTELY no need to apologize; I understand completely! Plus, you
don't know me from Adam since I've not posted to the PHP groups before.

Unfortunately though, I'm still stuck. But the good news is, I don't
think the "problem" is in any of the code I posted: The bad news is, I
don't think the "problem" is in any of the code I posted.
Somehow, in some way, I've apparently created booleans for the radio
buttons and made an on/off or true/false logic indicator out of a set
of radio buttons! HOW that happens is complete news to me! But I quit
for the day; tomorrow it'll look fresher to me.
Jeez, I hope it's not an HTML screwup<G>! I can tell I'll never hear
the end of it if it is!

I rewrote the code and created a stub that is identical to the
non-working code, except it ONLY has the one radion button category for
the form; nothing else is on/in the form visually or codewise but the
one catefory of radio buttons. It works perfectly.
So, I made a 2-column chart in OOo and placed the relevant code from
one in one column, and the other program's code in the second column.
They are exactly the same codewise! Unless I screwed up the macro I
wrote, they are character for character identical except at the
beginning and very end. And, without the "<value..." et al <g>.

I'll start in fresh on it tomorrow.

It's a lost cause and unless you have a constant-width font, this will
be a mess, but here's the comparison columns:
I figured it can't hurt to try for those who are curious.
TEST STUB, working
REAL CODE, not working

<Div class = "radio">

Would you like a resonse? &nbsp &nbsp

<input type="radio" name="item" value="0">0

<input type="radio" name="item" value="1">1

<input type="radio" name="item" value="2">2

<input type="radio" name="item" value="3">3

<input type="radio" name="item" value="4">4

<input type="radio" name="item" value="5">5

<input type="radio" name="item" value="6">6

<input type="radio" name="item" value="7">7

<input type="radio" name="item" value="8">8

<input type="radio" name="item" value="9">9

<input type="radio" name="item" value="10">10

value="<?php

if(isset($_POST['item'])){echo $_POST['item'];} ?>" /></div>

<br><br>
<Div class = "radio">

Item/s purchased: &nbsp

&nbsp

<input type="radio" name="item" <value = "0">0

<input type="radio" name="item" <value = "1">1

<input type="radio" name="item" <value = "2"2

<input type="radio" name="item" <value = "3"3

<input type="radio" name="item" <value = "4"4

<input type="radio" name="item" <value = "5"5

<input type="radio" name="item" <value = "6"6

<input type="radio" name="item" <value = "7"7

<input type="radio" name="item" <value = "8"8

<input type="radio" name="item" <value = "9"9

<input type="radio" name="item" <value = "10"10

value = "<?php if(isset($_POST['item'])){echo $_POST['item'];} ?>"
</div>

if(isset($post['item'])){$_item = $post['item'];}else{$_item =
'';}
if(isset($post['item'])){$_item = $post['item'];}else{$_item = '';}

echo "Item? <br\"" . $_item . "\" <br><br>";
echo "Item Rating: <br\"" . $_item . "\" <br><br>";

Item: '. $_item . '<br>
item: '. $_item .' <br>

Regards,

Twayne

Jun 27 '08 #7
Twayne wrote:
> Twayne wrote:
WARNING: A very thick-skulled, occasionally myopic OP bottom posted a
response to Jerry:

Twayne wrote:
Hi,

Newbie to PHP here, no C or other relevant background, so pretty
niave w/r to the nuances etc. but I think this is pretty basic.

XP Pro, SP2+, PHP 4.4.7, XAMPP Local Apache Server 6.something I
think and running as a service, Using NoteTab Pro as an IDE (works
well). If you need more, just ask.
...
Below are all EXACT pastes, not hand typed & not touched otherwise:

From the Working Form:
In Main part:
------------
<Div class = "radio">
Would you like a resonse? &nbsp &nbsp
<input type="radio" name="respond" value="Yes">Yes -
<input type="radio" name="respond" value="No">No -
<input type="radio" name="respond" value="Don't Care"It does not
matter <br><br>
value="<?php if(isset($_POST['respond'])){echo $_POST['respond'];}
" /></div>
[ NOTE I have no idea what the "/>" is or does but it
doesn't seem to care whether it's there or not! It came from
some code I scraped somwhere along the line ]

---------------
and in the result.php;
...
if(isset($pos t['respond'])){$_respond =
$post['respond'];}else{$_respon d = '';}
...
...
echo "Respond? <br\"" . $_respond . "\" <br><br>";
...
$mail_body = '
.
Respond: '. $_respond . '<br>
...

As I said, that all works fine.
============= ==========
In the PROBLEM form (diff var name):
In Main Part:
-------------------
<Div class = "radio">
Item/s purchased: &nbsp &nbsp
<input type="radio" name="item" <value = "0">0
<input type="radio" name="item" <value = "1">1
<input type="radio" name="item" <value = "2"2
<input type="radio" name="item" <value = "3"3
<input type="radio" name="item" <value = "4"4
<input type="radio" name="item" <value = "5"5
<input type="radio" name="item" <value = "6"6
<input type="radio" name="item" <value = "7"7
<input type="radio" name="item" <value = "8"8
<input type="radio" name="item" <value = "9"9
<input type="radio" name="item" <value = "10"10
<value = "<?php if(isset($_POST['item'])){echo $_POST['item'];} ?>"
</div>
------------------

And the result.php:
...
if(isset($pos t['item'])){$_item = $post['item'];}else{$_item = '';}
...
echo "Item Rating: <br\"" . $_item . "\" <br><br>";
...
$mail_body = '
.
item: '. $_item .' <br>
...
=========== =
...
In addition to what Rik said - it is $_POST['item'], not
$post['item'].
And before you learn PHP, you need some understanding of HTML. If
you don't have correct HTML, there is nothing you can do in PHP to
make things work.


Thanks, Jerry. The "<value" was an aberration of frustration, I
think; no other reason for it to be there. I'm no guru at HTML but
I do know better. I broke the lines up that way to keep them all
onscreen without having to scroll horizontally. It's gone and a new
ZIP made<g>. Poor houskeeping, I know.

I assume the '$post' you're talking about is here:
if(isset($post['item'])){$_item = $post['item'];}else{$_item = '';}
?

Making the '$post' to $_POST change was no help, BUT ... I think I
have to back up and get another head-around on this. I thought I'd
figured out what the syntax of all the line parts meant, but
apparently I'm still not getting it straight.

I'll let you know either way whether I get it working or have another
question.

Thanks much,

Twayne

Sorry, from your post it looked like you weren't familiar with HTML.
We sometimes get people here who don't understand HTML much (if at
all), and they complain because their PHP isn't working. When in
reality the problem is back in the HTML. And your error is very
typical of the type of error those people make.

If you are familiar with HTML, then my apologies.

Hi,

AB-SO-LUTELY no need to apologize; I understand completely! Plus, you
don't know me from Adam since I've not posted to the PHP groups before.

Unfortunately though, I'm still stuck. But the good news is, I don't
think the "problem" is in any of the code I posted: The bad news is, I
don't think the "problem" is in any of the code I posted.
Somehow, in some way, I've apparently created booleans for the radio
buttons and made an on/off or true/false logic indicator out of a set
of radio buttons! HOW that happens is complete news to me! But I quit
for the day; tomorrow it'll look fresher to me.
Jeez, I hope it's not an HTML screwup<G>! I can tell I'll never hear
the end of it if it is!

I rewrote the code and created a stub that is identical to the
non-working code, except it ONLY has the one radion button category for
the form; nothing else is on/in the form visually or codewise but the
one catefory of radio buttons. It works perfectly.
So, I made a 2-column chart in OOo and placed the relevant code from
one in one column, and the other program's code in the second column.
They are exactly the same codewise! Unless I screwed up the macro I
wrote, they are character for character identical except at the
beginning and very end. And, without the "<value..." et al <g>.

I'll start in fresh on it tomorrow.

It's a lost cause and unless you have a constant-width font, this will
be a mess, but here's the comparison columns:
I figured it can't hurt to try for those who are curious.


TEST STUB, working

REAL CODE, not working

<Div class = "radio">

Would you like a resonse? &nbsp &nbsp

<input type="radio" name="item" value="0">0

<input type="radio" name="item" value="1">1

<input type="radio" name="item" value="2">2

<input type="radio" name="item" value="3">3

<input type="radio" name="item" value="4">4

<input type="radio" name="item" value="5">5

<input type="radio" name="item" value="6">6

<input type="radio" name="item" value="7">7

<input type="radio" name="item" value="8">8

<input type="radio" name="item" value="9">9

<input type="radio" name="item" value="10">10

value="<?php

if(isset($_POST['item'])){echo $_POST['item'];} ?>" /></div>

<br><br>

<Div class = "radio">

Item/s purchased: &nbsp

&nbsp

<input type="radio" name="item" <value = "0">0

<input type="radio" name="item" <value = "1">1

<input type="radio" name="item" <value = "2"2

<input type="radio" name="item" <value = "3"3

<input type="radio" name="item" <value = "4"4

<input type="radio" name="item" <value = "5"5

<input type="radio" name="item" <value = "6"6

<input type="radio" name="item" <value = "7"7

<input type="radio" name="item" <value = "8"8

<input type="radio" name="item" <value = "9"9

<input type="radio" name="item" <value = "10"10

value = "<?php if(isset($_POST['item'])){echo $_POST['item'];} ?>" </div>

if(isset($post['item'])){$_item = $post['item'];}else{$_item = '';}

if(isset($post['item'])){$_item = $post['item'];}else{$_item = '';}

echo "Item? <br\"" . $_item . "\" <br><br>";

echo "Item Rating: <br\"" . $_item . "\" <br><br>";

Item: '. $_item . '<br>

item: '. $_item .' <br>
Regards,

Twayne
OK, if you're expecting the be able to get the value of the radio button
in the same page that you wrote the radio button, it won't work (unless
the page is resubmitted). i.e.

<div>
<input type="radio" name="item" <value = "0">0
<input type="radio" name="item" <value = "1">1
value = "<?php if(isset($_POST['item'])){echo $_POST['item'];} ?>" </div>

$_POST['item'] will never be set unless your form submits the request
back to the same page. This is because PHP is server side - and all PHP
is executed before the page is ever sent to the browser. I don't know
if you're doing this or not - you didn't give all of the code. But the
code you show won't work. Other than that, I don't see any obvious
problems.

Also, in your php.ini file, enable all errors and display them:

error_reporting =E_ALL
display_errors = on

You should always have this set in a development system (but never in a
production system). They might help show something I'm not seeing.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 27 '08 #8
Twayne wrote:
>> Twayne wrote:
WARNING: A very thick-skulled, occasionally myopic OP bottom
posted a response to Jerry:

Twayne wrote:
>Hi,
>>
>Newbie to PHP here, no C or other relevant background, so pretty
>niave w/r to the nuances etc. but I think this is pretty basic.
>>
>XP Pro, SP2+, PHP 4.4.7, XAMPP Local Apache Server 6.something I
>think and running as a service, Using NoteTab Pro as an IDE
>(works well). If you need more, just ask.
...
>Below are all EXACT pastes, not hand typed & not touched
>otherwis e: From the Working Form:
> In Main part:
> ------------
><Div class = "radio">
>Would you like a resonse? &nbsp &nbsp
><input type="radio" name="respond" value="Yes">Yes -
><input type="radio" name="respond" value="No">No -
><input type="radio" name="respond" value="Don't Care"It does
>not matter <br><br>
> value="<?php if(isset($_POST['respond'])){echo
>$_POST['respond'];}
>>" /></div>
> [ NOTE I have no idea what the "/>" is or does but it
>doesn't seem to care whether it's there or not! It came from
> some code I scraped somwhere along the line ]
>>
>---------------
>and in the result.php;
>...
>if(isset($ post['respond'])){$_respond =
>$post['respond'];}else{$_respon d = '';}
>...
>...
>echo "Respond? <br\"" . $_respond . "\" <br><br>";
>...
>$mail_bo dy = '
>.
>Respond: '. $_respond . '<br>
>...
>>
>As I said, that all works fine.
>========== =============
>>
>>
>In the PROBLEM form (diff var name):
> In Main Part:
>-------------------
><Div class = "radio">
>Item/s purchased: &nbsp &nbsp
><input type="radio" name="item" <value = "0">0
><input type="radio" name="item" <value = "1">1
><input type="radio" name="item" <value = "2"2
><input type="radio" name="item" <value = "3"3
><input type="radio" name="item" <value = "4"4
><input type="radio" name="item" <value = "5"5
><input type="radio" name="item" <value = "6"6
><input type="radio" name="item" <value = "7"7
><input type="radio" name="item" <value = "8"8
><input type="radio" name="item" <value = "9"9
><input type="radio" name="item" <value = "10"10
><value = "<?php if(isset($_POST['item'])){echo $_POST['item'];}
>?>" </div>
>------------------
>>
>And the result.php:
>...
>if(isset($ post['item'])){$_item = $post['item'];}else{$_item =
>'';} ...
>echo "Item Rating: <br\"" . $_item . "\" <br><br>";
>...
>$mail_bo dy = '
>.
>item: '. $_item .' <br>
>...
>========== ==
...
In addition to what Rik said - it is $_POST['item'], not
$post['item'].
And before you learn PHP, you need some understanding of HTML. If
you don't have correct HTML, there is nothing you can do in PHP to
make things work.


Thanks, Jerry. The "<value" was an aberration of frustration, I
think; no other reason for it to be there. I'm no guru at HTML but
I do know better. I broke the lines up that way to keep them all
onscreen without having to scroll horizontally. It's gone and a
new ZIP made<g>. Poor houskeeping, I know.

I assume the '$post' you're talking about is here:
if(isset($post['item'])){$_item = $post['item'];}else{$_item =
'';} ?

Making the '$post' to $_POST change was no help, BUT ... I think I
have to back up and get another head-around on this. I thought I'd
figured out what the syntax of all the line parts meant, but
apparently I'm still not getting it straight.

I'll let you know either way whether I get it working or have
another question.

Thanks much,

Twayne


Sorry, from your post it looked like you weren't familiar with
HTML. We sometimes get people here who don't understand HTML much
(if at all), and they complain because their PHP isn't working.
When in reality the problem is back in the HTML. And your error
is very typical of the type of error those people make.

If you are familiar with HTML, then my apologies.

Hi,

AB-SO-LUTELY no need to apologize; I understand completely! Plus,
you don't know me from Adam since I've not posted to the PHP groups
before. Unfortunately though, I'm still stuck. But the good news is,
I don't
think the "problem" is in any of the code I posted: The bad news
is, I don't think the "problem" is in any of the code I posted.
Somehow, in some way, I've apparently created booleans for the
radio buttons and made an on/off or true/false logic indicator out
of a set of radio buttons! HOW that happens is complete news to me!
But I quit for the day; tomorrow it'll look fresher to me.
Jeez, I hope it's not an HTML screwup<G>! I can tell I'll never
hear the end of it if it is!

I rewrote the code and created a stub that is identical to the
non-working code, except it ONLY has the one radion button category
for the form; nothing else is on/in the form visually or codewise
but the one catefory of radio buttons. It works perfectly.
So, I made a 2-column chart in OOo and placed the relevant code
from one in one column, and the other program's code in the second
column. They are exactly the same codewise! Unless I screwed up the
macro I wrote, they are character for character identical except at
the beginning and very end. And, without the "<value..." et al <g>.

I'll start in fresh on it tomorrow.

It's a lost cause and unless you have a constant-width font, this
will be a mess, but here's the comparison columns:
I figured it can't hurt to try for those who are curious.


TEST STUB, working

REAL CODE, not working

<Div class = "radio">

Would you like a resonse? &nbsp &nbsp

<input type="radio" name="item" value="0">0

<input type="radio" name="item" value="1">1

<input type="radio" name="item" value="2">2

<input type="radio" name="item" value="3">3

<input type="radio" name="item" value="4">4

<input type="radio" name="item" value="5">5

<input type="radio" name="item" value="6">6

<input type="radio" name="item" value="7">7

<input type="radio" name="item" value="8">8

<input type="radio" name="item" value="9">9

<input type="radio" name="item" value="10">10

value="<?php

if(isset($_POS T['item'])){echo $_POST['item'];} ?>" /></div>

<br><br>

<Div class = "radio">

Item/s purchased: &nbsp

&nbsp

<input type="radio" name="item" <value = "0">0

<input type="radio" name="item" <value = "1">1

<input type="radio" name="item" <value = "2"2

<input type="radio" name="item" <value = "3"3

<input type="radio" name="item" <value = "4"4

<input type="radio" name="item" <value = "5"5

<input type="radio" name="item" <value = "6"6

<input type="radio" name="item" <value = "7"7

<input type="radio" name="item" <value = "8"8

<input type="radio" name="item" <value = "9"9

<input type="radio" name="item" <value = "10"10

value = "<?php if(isset($_POST['item'])){echo $_POST['item'];} ?>"
</divif(isset($po st['item'])){$_item = $post['item'];}else{$_item =
'';}

if(isset($po st['item'])){$_item = $post['item'];}else{$_item = '';}

echo "Item? <br\"" . $_item . "\" <br><br>";

echo "Item Rating: <br\"" . $_item . "\" <br><br>";

Item: '. $_item . '<br>

item: '. $_item .' <br>
Regards,

Twayne

OK, if you're expecting the be able to get the value of the radio
button in the same page that you wrote the radio button, it won't
work (unless the page is resubmitted). i.e.

<div>
<input type="radio" name="item" <value = "0">0
<input type="radio" name="item" <value = "1">1
value = "<?php if(isset($_POST['item'])){echo $_POST['item'];} ?>"
</div>
$_POST['item'] will never be set unless your form submits the request
back to the same page. This is because PHP is server side - and all
PHP is executed before the page is ever sent to the browser. I don't
know if you're doing this or not - you didn't give all of the code.
But the code you show won't work. Other than that, I don't see any
obvious problems.
Oh; sorry, yes, I probably should have included that; assumed it would
be assumed. Sorry.
Rest assured, the code is indeed working, just as I described.
>
Also, in your php.ini file, enable all errors and display them:

error_reporting =E_ALL
display_errors = on
That sounds like good advice; will do. Thanks!
>
You should always have this set in a development system (but never in
a production system). They might help show something I'm not seeing.
Looking at it again today afresh, I think my attack to the problem was
wrong yesterday. Instead of building a stub I should have started
ripping apart the orginal problem code and eliminating things until it's
simple enough to see better and analyze. THAT is what I should have
presented here.

I'll be back; not sure when I can get back to it but should be able to
give it an hour or so today.

Regards & thanks,

Twayne
Jun 27 '08 #9
SCRATCH THAT POST! COPIED WRONG FILE!! GOTTA GO - WILL BE BACK LATER
TODAY/TOMORROW. APOLOGIES!
Jun 27 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2485
by: bawar | last post by:
Hellow, I don't seem to be able to send trough the variable 'language' from my form to the php-variable $language that I want to use in my session... I first tried in the form with a drop down menu (select) and now with radio-buttons but it won't work... What am I doing wrong? BTW: the variable 'toevoegen' is passed correctly from the form to the php. <?php
2
2719
by: Pat Scott | last post by:
I am looking for a general purpose javascript snippet that enables me to <div> or <span> HTML to make portions of the form be hidden and then appear. The form contains about 12 sections and some sections can contain subsections. When the user clicks on a checkbox, I want previously hidden text boxes, radio buttons, text, drop down menus, and additional checkboxes to appear. In some cases, clicking on a checkbox in a section can cause...
1
6160
by: sman | last post by:
Hi, I recently read this article on About.com on how to create required fields for a form: http://javascript.about.com/library/scripts/blformvalidate.htm Everything works great except that there are no instructions on how to make checkboxes and radio buttons required. I've tried adding these to my form, but I'm having no luck. Anyone know how to add radio buttons and checkboxes using the existing code mentioned on the url? Thank you!
2
11964
by: James P. | last post by:
Help, I need to display radio buttons on a form. The data is from SQL table: each row in each table is displayed as a radio button. I have multiple SQL tables so I understand I need to put them each in a GroupBox. All the examples I saw from the books or from the web show me how to add static radio buttons at design, or dynamically at run time but with fixed radio buttons (like from an array). I need to create radio buttons based...
22
7964
by: Saul | last post by:
I have a set of radio buttons that are created dynamically, after rendered I try loop thru this set by getting the length of the set, but I keep getting an error stating the element is undefined. I am using getElelementsByName since these are radio buttons, but it seems that the dynamic element is not seen!!! This is my code... please let me know if there is anything that I am doing wrong! - thanks ---- ....
4
2259
by: Cerebral Believer | last post by:
Hi I need help! Forgive me I am a PHP newbie. I have a small script that enables me to send a form from an HTML page. I want to use the HTML formatted form because the design of my website is complex, and I don't want to have to mess around with formatting a page using HTML within php. So basically the "action" of the HTML page sends the form to "ProcReg.php". This is the code: <?php /* Script name: ProcReg.php
2
1945
by: Cerebral Believer | last post by:
Hi folks, Can anyone help me with this form: http://futurebydesign-music.com/_member/club_fbd_reg.php I have followed to coding instructions aas closely as I can, but I am getting errors about not filling in all the fields on the form correctly when I test it. Is validating a form with radio buttons difficult?
7
3328
by: IchBin | last post by:
I am trying to programmatically set a radio button in a table of radio buttons. I have two problems with the code below: 1 - I can not prepare the <Formstatement to be printed by php. (syntax of the hyphens, quotes) my fault! 2 - If I delete the <Formand </Formstatements I can build the table of radio buttons correctly, HTML wise. The fifth radio button has 'checked=True'. The problem is even though I set radio button 5 to be...
11
8177
by: TokyoJ | last post by:
I run a small camp in Alaska for kids and my director is asking for a web form. Could someone please have a look and offer some advice on where I'm making mistake(s)? I'm using the RegExp function to validate 3 types of fields: text, radio button, dropdown menu. but the code doesn't validate. After 2 days, it's time I asked for guidence. Criteria: Text: only alphabet, no numerals, allowed Radio: one must be selected, Dropdown: an option...
0
8718
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9044
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7969
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6645
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5966
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4476
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4738
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2537
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2118
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.