Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Processing html input checkbox within php program Q's?

Status
Not open for further replies.

BobMCT

IS-IT--Management
Sep 11, 2000
756
US
Maybe this should be an HTML Q but seeing how its being done with PHP perhaps this is the better group.
Output form snippet:
<form . . . >
.
PSK? <input type="checkbox" name="_netsiteSecPSK" $_netsiteSecPSKY />
AES? <input type="checkbox" name="_netsiteSecAES" $_netsiteSecAESY />
.
</form>

Input processing:
.
$_netsiteSecPSK = $_POST['_netsiteSecPSK'];
$_netsiteSecAES = $_POST['_netsiteSecAES'];
.
and I receive this error notice upon input:

Notice: Undefined index: _netsiteSecPSK in . . .
Notice: Undefined index: _netsiteSecAES in . . .

I've checked and rechecked and rechecked my forms field definitions but I DO NOT receive these two fields back with the form.

I've researched various tech sites and I seem to be coding the form fields correctly so what gives? I know I must be missing something very simple. But I cannot seem to see it (yet).

So, if anyone can shed some light on this, PLEASE DO?

Thanks [bugeyed]

 
Hi

BobMCT said:
I DO NOT receive these two fields back with the form.
Correct, assuming the checkboxes were not checked. Browsers not send information about unchecked checkboxes. You may either
[ul]
[li]check whether the given items are set :
PHP:
[navy]$_netsiteSecPSK[/navy] [teal]=[/teal] [highlight][b]isset[/b][teal]([/teal][navy]$_POST[/navy][teal][[/teal][i][green]'_netsiteSecPSK'[/green][/i][teal]]) ?[/teal][/highlight] [navy]$_POST[/navy][teal][[/teal][i][green]'_netsiteSecPSK'[/green][/i][teal]][/teal] [highlight][teal]:[/teal] [i][green]''[/green][/i][/highlight][teal];[/teal]
[navy]$_netsiteSecAES[/navy] [teal]=[/teal] [highlight][b]isset[/b][teal]([/teal][navy]$_POST[/navy][teal][[/teal][i][green]'_netsiteSecAES'[/green][/i][teal]]) ?[/teal][/highlight] [navy]$_POST[/navy][teal][[/teal][i][green]'_netsiteSecAES'[/green][/i][teal]][/teal] [highlight][teal]:[/teal] [i][green]''[/green][/i][/highlight][teal];[/teal]
[/li]
[li]provide some defaults before using the items :
PHP:
[highlight][navy]$_POST[/navy] [teal]+= [[/teal][i][green]'_netsiteSecPSK'[/green][/i] [teal]=>[/teal] [i][green]''[/green][/i][teal],[/teal] [i][green]'_netsiteSecAES'[/green][/i] [teal]=>[/teal] [i][green]''[/green][/i][teal]];[/teal][/highlight]
[navy]$_netsiteSecPSK[/navy] [teal]=[/teal] [navy]$_POST[/navy][teal][[/teal][i][green]'_netsiteSecPSK'[/green][/i][teal]];[/teal]
[navy]$_netsiteSecAES[/navy] [teal]=[/teal] [navy]$_POST[/navy][teal][[/teal][i][green]'_netsiteSecAES'[/green][/i][teal]];[/teal]
[/li]
[/ul]

Feherke.
feherke.ga
 
Thanks feherke,
I must have spent too many hours on that issue yesterday and missed that. Your help is greatly appreciated.
 
Did HTML change on me or are we still missing "value=" in the form?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top