Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-16-2011, 06:01 PM   PM User | #1
docock
Regular Coder

 
Join Date: Feb 2007
Posts: 197
Thanks: 21
Thanked 1 Time in 1 Post
docock is an unknown quantity at this point
validating textbox and selectbox

I want to validate a textbox and a selectbox. The textbox may not be empty and the selectbox may not contain 'Kies een prijsstelling..' otherwise an errormessage is displayed.

I've got the coding below, but when I test it with the textbox empty and the selectbox focussed on the 'Kies een prijsstelling..' line, the error message ain't displayed. How come ?

my html:
Code:
Prijs*<br /><input id="prijs" name="prijs" style="width:75px;" type="text" value="<?php echo"$prijs" ?>" onblur="this.value=formatCurrency(this.value);" /> &nbsp;of&nbsp; 
<select name="prijssoort" onchange="document.getElementById('prijs').value = '';">
<option value="1" selected="selected">Kies een prijsstelling..</option>
<option value="2">Bieden</option>
<option value="3">N.o.t.k. (Nader overeen te komen)</option>
<option value="4">T.e.a.b.</option>
<option value="5">Ruilen</option>
<option value="6">Gratis</option>
</select>
my php:
Code:
if ($prijs=='' && prijssoort=='1'){echo "Prijs of prijssoort is een verplicht veld";}
docock is offline   Reply With Quote
Old 09-16-2011, 11:34 PM   PM User | #2
Awesomolocity
New to the CF scene

 
Join Date: Sep 2011
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
Awesomolocity is an unknown quantity at this point
Code:
if ($prijs=='' && prijssoort=='1'){echo "Prijs of prijssoort is een verplicht veld";}
It may help if you had a $ before prijssoort
Awesomolocity is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 03:59 AM.


Advertisement
Log in to turn off these ads.