Digital Point Forums
San Diego Personal Trainer

Go Back   Digital Point Forums > Design & Development > Programming > PHP
Google Analytics
Log In to view
your analytics

Reply
 
Thread Tools
  #1  
Old Feb 29th 2008, 5:10 am
sudhakararaog sudhakararaog is offline
Grunt
 
Join Date: Nov 2007
Posts: 58
sudhakararaog is on a distinguished road
unable to read checkbox and radio

i am using a self submitting form

<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST" id="test2" name="test1">

i need to do a validation of textfields, checkboxes, radio buttons

i am able to read, display and validate textfields after the form has been submitted however i am getting an error for

checkbox and radio buttons.

code for textfields

username <input type="text" name="username" value="<?php echo($username) ; ?>" />

$username = htmlentities($_POST["username"]);

if($username == "") { $error.=" enter username <br />"; }

for checkboxes and radio buttons i am getting
"Notice: Undefined index: checkboxname " for checkbox
"Notice: Undefined index: radiobuttonname " for radio button

presently the code for checkbox and radio button is

<input type="checkbox" name="cbox" value="abc" />

$deposit = $_POST["cbox"];


<input type="radio" name="radioname" value="one"> one
<input type="radio" name="radioname" value="two"> two

$radioname = $_POST["radioname"];

i have tried cbox[] radioname[] however i keep getting
"Notice: Undefined index: cbox " and "Notice: Undefined index: radioname "
for checkbox and radio button

please advice.

thanks.
Reply With Quote
  #2  
Old Feb 29th 2008, 5:14 am
jestep's Avatar
jestep jestep is offline
of the Nightfall
 
Join Date: Dec 2004
Location: Austin
Posts: 2,398
jestep is a name known to alljestep is a name known to alljestep is a name known to alljestep is a name known to alljestep is a name known to alljestep is a name known to all
Try dumping the post array and see if there is any values for the radio or check boxes.

Do: print_r($_POST);

At the the top of the form processing section of the script.
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
We were unable to read your Sitemap. ravencin Google Sitemaps 3 Aug 18th 2007 6:42 pm
Live Internet Radio - Radio music codes and live radio from this website. exodus Sites 7 Jun 8th 2007 10:34 am
3 Radio, 2 Checkbox - 1 Variable Form Javascript Form SH77 JavaScript 4 Mar 23rd 2007 11:41 am
Clear Channel Radio Selects Google As Its Search Partner For 1,100 Radio Station Web infonote General Business 0 Apr 5th 2006 9:32 am
Media Player unable to read IFO and VOB eye-2i.com General Chat 2 Oct 20th 2005 8:59 am


All times are GMT -8. The time now is 1:15 pm.