Please help! How can I validate Radio Buttons and List Menu with PHP.
Hello everyone, I have been learning PHP step by step and
making little projects.
The point is I find it easy to learn by doing "practical
projects."
I have been reading the David Powers's Book on PHP Solutions
and it's really great, however there is nothing mentioned regarding
Validating Radio buttons. I know the book cannot cover every aspect
of PHP and maybe someone in here can help.
I have been learning how to process HTML forms with PHP.
The problem is every book or tutorial I have read or
encountered fall short on validation.
I'm wondering how I can learn to validate Radio Buttons and
Select List Menu.
I have managed to create validation for all other fields but
have no clue as to how I can get validation for Radio Buttons and
List Menu.
I would also like an error message echoed when the user does
not click a button or make a selection and try to submit the form.
I would appreciate any help.
Patrick
It's not that default value is "None." In fact it's not. It
will only be
"none" when the form is submitted.
Also if your submit button is names 'send' then
$_POST['send'] will only be
set if the form was submitted.
Make sure you didn't hit the refresh button on your browser
which usually
reposts the information. Also make sure you did not reach the
form from
another form with the same button names.
Otherwise paste the snippet.
Also you can check what fields are set in the post array by
adding this to
the top of (or anywhere on) your page:
print_r($_POST);
Cosmo
"Webethics" <[email protected]> wrote in
message
news:[email protected]...
>
quote:
Originally posted by:
Newsgroup User
> Off the top of my head this should be no different than
your radio buttons
> except that 'productSelection' will always fail the
!isset check when the
> form is submitted since the default value is "None", and
therefore always
> set. :-)
>
> So how about this..?
> <?php
> if (isset($_POST['send']) and
($_POST['productSelection'] == "None"))
> {echo "Please select a product.";}
> ?>
>
>
>
>
> "Webethics" <[email protected]> wrote
in message
> news:[email protected]...
> > Another question - how do i applied the code you
just showed me to
> > select
> > menu
> > or select list?
> >
> > This is the list:
> >
> > <div class="problemProduct">
> > <label for="productSelection"><span
class="product_label">Product
> > Name.</span></label>
> > <select name="productSelection" id="products"
class="selection">
> > <option value="None">-------------Select a
product----------</option>
> > <option value="Everex DVD Burner">Everex DVD
Burner</option>
> > <option value="Vidia DVD Burner">Vidia DVD
Burner</option>
> > <option value="Excerion Super Drive">Excerion
Super Drive</option>
> > <option value="Maxille Optical Multi
Burner">Maxille Optical Multi
> > Burner</option>
> > <option value="Pavilion HD Drives">Pavilion
HD Drives</option>
> > </select>
> > </div>
> >
> > I thought I could just change the name is the code
from operatingSystem
> > to
> > productSelection.
> >
> > Something like this:
> >
> > From this:
> >
> > <?php
> > if (isset($_POST[send]) and
!isset($_POST['operatingSystem']))
> > {echo "Please select an operating system.";}
> > ?>
> >
> > To this:
> >
> > <?php
> > if (isset($_POST[send]) and
!isset($_POST['productSelection']))
> > {echo "Please select an operating system.";}
> > ?>
> >
> > But this does not work, any ideas?
> >
> > Patrick
> >
>
>
>
>
> Hey, I tried this about but as you mentioned, since the
default product
> value
> is "None" an error message appears when the page loads.
>
> Is there a way to code this things so that even though
the default value
> is
> "None" there ia no error message untle you hit the
submit?
>
> When I applied the code, it messes up the previous code,
now the operating
> system is requiring an entry on page load.
>
> When I remove the code from the list menu everything
goes back to normal.
>
> I know this is a little much but I have no other
alternatives.
>
> Patrick
>
Similar Messages
-
How can i get Radio buttons and parameters in a Single Straight Line
Hi Experts,
How can i get Radio buttons and parameters in a Single Straight Line...
Example:
r1 r2 p1 p2.....
Cheers,
Priya
Points granted.Write the following code for the selection screen:
DECLARATION OF PARAMETERS.
SELECTION-SCREEN: BEGIN OF BLOCK select WITH FRAME TITLE text-001,
BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(10) FOR FIELD p_detail.
PARAMETERS p_detail RADIOBUTTON GROUP r1 DEFAULT 'X'.
SELECTION-SCREEN COMMENT 25(10) FOR FIELD p_summry.
PARAMETERS p_summry RADIOBUTTON GROUP r1.
SELECTION-SCREEN: END OF LINE,
END OF BLOCK select.
this will solve your poblem surly. reward the points if you find helpful
Regards,
Siddarth -
Please Help, How can I get 24Frame .mov's to work with broadcast footage?
Hello,
I am desperate for some help. I have 24 Frame image sequences and 29.97 B-Roll footage that I need to work with. I am forced to work in the B-Roll frame rate because it is a mixture of scenes and all the interlace is different shot to shot.
So my question is how can I take this 24 Frame CG and get it to 29.97? I can’t conform it in Cinema Tools because it speeds up the timing. I can’t add pull down in After Effects because it looks really bad. Is there any other way that I can add pull down to this footage and have it still look good?
I am in desperate need for some help so even some conversation might get the ball rolling.
Thanks in advanceI'm really surprised that you say it is looking bad out of After Effects since that is a good way to add the pulldown. What is it that is looking bad? Is the comp set up correctly? Is the CG stuff a true 24? You might want to conform it to 23.98 in Cinema Tools, then try adding the pulldown in AE. I don't think it should matter except that you aren't truly pulling down to 30fps so you'll have to change the rate at some point.
The only other way I know to add the pulldown, is to use FinalCut at a 23.98 sequence, play it out to tape to add the pulldown, then capture it back in. -
after updating my Macbook Pro retina display to os x yosemite 10.10.2, the mause and track pad locks, and do not respond especially when using the Mac for a long period, please help, how can I solve this, I do not like feel like in windows, so I paid good money for this mack, I feel calm
Hi Buterem,
I'm sorry to hear you are having issues with your MacBook Pro since your recent Yosemite update. I also apologize, I'm a bit unclear on the exact nature of the issue you are describing. If you are having intermittent but persistent responsiveness issues with your mouse or trackpad, you may want to try using Activity Monitor to see if these incidents correspond to occupied system resources, especially system memory or CPU. You may find the following article helpful:
How to use Activity Monitor - Apple Support
If the entire system hangs or locks up (for example, if the system clock freezes and stops counting up), you may also be experiencing some variety of Kernel Panic. If that is the case, you may also find this article useful:
OS X: When your computer spontaneously restarts or displays "Your computer restarted because of a problem." - Apple Support
Regards,
- Brenden -
Hello,
I forget my passcode please help how can I get my itYou will need to try to restore your iPad from the same computer that you most recently synced to.
Read this: http://support.apple.com/kb/ht1212
If you can't do the restore then you will need to try Recovery Mode.
Read this: http://support.apple.com/kb/ht1808
Follow the instructions very carefully. -
i have windows 8 and I got this error "Adobe Photoshop has stopped working" whenever I start a program. please help. how can I fix this problem? many thanks
Please read these and proceed accordingly:
http://blogs.adobe.com/crawlspace/2012/07/photoshop-basic-troubleshooting-steps-to-fix-mos t-issues.html
http://forums.adobe.com/docs/DOC-2325 -
Hi,
Please help
How can I install flash player plugin (version 8) in browser
without
downloading setup or redirecting to macromedia site if flash
plugin is not
available in browser
ThanksVia Javascripting. Look for Flash detection kits at the
Adobe/Maromedia web
site and also at Internet search engines.
As well this forum focuses on database access issues and you
might find more
takers for this type of question in the Flash General forum.
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
"jiby" <[email protected]> wrote in message
news:e3odp2$pdc$[email protected]..
Hi,
Please help
How can I install flash player plugin (version 8) in browser
without
downloading setup or redirecting to macromedia site if flash
plugin is not
available in browser
Thanks -
my ipad2 is asking old id password, when i go to forget password link for that id then I am not getting any mail to reset the same. Please help how can i remove or change the old id.
You cannot remove or change the old ID. This is Find My iPhone Activation Lock. You need to recover the credentials for the Apple ID originally used to activate the iPad.
Check your spam and junk folders. -
Please help-how can I find accents on the keyboard when typing in French?
Please help.How can I find accents on the keyboard when typing in french?Thanks
You can also open the Keyboard Viewer & hold Option key & Shift+Option to see...
Option key...
Shift+Option or alt key... -
Please help, I can't find face time and Siri icon on my mini ipad? Just bought it I have the IMessage icon and is able to use it.
There is no Siri "icon". You access Siri using the Home button. But you may need to turn it on: Settings App > General > Siri. http://support.apple.com/kb/HT4992
Same for the FaceTime function (but if it is ON, there will be an icon): Settings App > FaceTime > [turn it on and set you Apple ID. http://support.apple.com/kb/HT4319 -
how can i get FIND button and hotmail button to the toolbar, and how do i update firefox i dont want to update automatically
Thanx 4 your "you're welcome" cor-el. It's now 4p.m. E.S.T. in Melbourne, Victoria, Australia on Thu. 29/9/2011 and my page tells me u sent this message 21Hrs. ago. To elaborate a bit on my prev. message: I soon realized that after R clicking in the 'Downloads' screen and then on the 2nd. in the drop down menu I could click and drag and drop the icon of the wanted download into the open file or memory device as required. I would take up the offer I see in this e-mail to participate in helping like you and others do but I won't as I feel I'm not experienced enough yet. Nevertheless u keep up the good work. Yours, james1.51.
P.S. I used Google Chrome for this not Mozilla but it's still me! -
How do you highlight iHelp Buttons and List Applet fields
How do you highlight iHelp Buttons and List Applet fields? I've followed all the steps in the Bookshelf but it seems like buttons and list applet fields do not highlight. The highlight feature only seems to work in form applets. Is this a known issue? Are there workarounds for this?
Thanks
Bernhard
Edited by: Bernhard on Dec 12, 2011 2:06 PMBernhard
I remember that colors of single list applet fields cannot be changed, since the whole list is regarded as one "control" itself. It works for single fields in form applets (as you said) but not in list applets. There is a document in MyOracleSupport pointing this out, but at the moment I can't find it.
Regarding iHelp Buttons I have no idea. -
My iPhone, iPad and iPod are all associated with the same Apple ID. How can I remove the iPod and associate it with a new Apple ID without affecting the data on the other devices (note: there is no data on the iPod I want to keep)?
Very simple. Turn off Find my iDevice, then Tap Settings, General, Erase, Erase all content and settings.
-
How can i get the "Do recursive listing.vi" with the sub-vi, because my is lost???
THXI think you must be using LV 8.x...
Do a LabVIEW repair to get it back or else, use the attached one.
- Partha
LabVIEW - Wires that catch bugs!
Attachments:
Recursive File List.vi 33 KB -
How can I share my music and some apps with my children's devices, but not share iMessage
How can I share my music and some apps with my children's devices, but not share iMessage
Then only set up your account in "Settings > iTunes & App Stores" and don't give them your password .
Maybe you are looking for
-
How to move contacts from one account to another
I have 2 exchange accounts configured in my iPhone, one Corp exchange account and one personal exchange account, both have Contacts sync enabled. I noticed somehow all of new created Contacts are under Corp account, these Contacts do not show up on m
-
HT201209 How can i move a redeemed itunes gift card from one apple id to another?
I accidently redeemed two gifts card on one sons account instead of one on each of their accounts, can I move one of the gift cards to the other account?
-
How do i remove camera card from super drive
Accidently dropped sdhd ccamera card into w
-
Crystal Report XI Release 2 stuck in install loop
Post Author: jerryk CA Forum: Upgrading and Licensing Hi, Since upgrading from Crystal Reports XI to release 2 (Windows XP pro), I have been stuck in an install loop. Each time I launch Crystal Reports XI Release 2 from the start menu is says "insta
-
Numerous files are listed as "no data". Why?
I have a project containing about 900 jpegs and audio files. Some audio was imported as .wav files and some was recorded in FCPX using the record function. When I organise by file type, out of the 900 files, about 150 go in a category called "No Da