By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,776 Members | 1,506 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,776 IT Pros & Developers. It's quick & easy.

Send maximum value to either of two database fields?

P: n/a
Hi there,

I'm a complete zero at javascript in need of a hero. I run a free,
non-commercial site which includes a searchable database of hotels in
Morocco.

Find the page at http://www.triotours.com/faq/ma/hotel-search.htm

The form works fine, except for two essential functions:

1. Visitors enter the maximum amount of money they want to spend per night
("maxrate")
2. Visitors then enter whether the maximum amount is for a single or a
double room ("roomtype")

The CGI script would then search for a value between 1 and "maxrate" in the
field set by "roomtype", which could be either "single" or "double".

Can anyone of you help me with the code to do this? It would be much
appreciated!
Jul 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
In article <d1**********@reader11.wxs.nl>, triotours@*N0SPAM*planet.nl
enlightened us with...

The CGI script would then search for a value between 1 and "maxrate" in the
field set by "roomtype", which could be either "single" or "double".


This is a javascript group.

What language is your CGI?
Try posting this at a group geared to that.

comp.lang.perl would be your best bet, I would guess, since you called it a
CGI script. :)

--
--
~kaeli~
A man's home is his castle..., in a manor of speaking.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2

P: n/a
OK, I can see what you mean. :-)

But I was told I could use javascript to "assemble" the right info
client-side on the html page BEFORE sending it to the script.

Only thing is, I have no clue about javascript.

"kaeli" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <d1**********@reader11.wxs.nl>, triotours@*N0SPAM*planet.nl
enlightened us with...

The CGI script would then search for a value between 1 and "maxrate" in the field set by "roomtype", which could be either "single" or "double".
This is a javascript group.

What language is your CGI?
Try posting this at a group geared to that.

comp.lang.perl would be your best bet, I would guess, since you called it

a CGI script. :)

--
--
~kaeli~
A man's home is his castle..., in a manor of speaking.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #3

P: n/a
dysfunctional wrote:
OK, I can see what you mean. :-)

But I was told I could use javascript to "assemble" the right info
client-side on the html page BEFORE sending it to the script.

Only thing is, I have no clue about javascript.


There is no point to 'assembling' the info on the client
machine. Just post the values back to your server and deal with
them there. Why make your page dependent on JavaScript
needlessly?

You have to validate the return values on the server anyway -
users may not have JavaScript enabled and the return may not
have actually come from your page - you have no idea how the
return values were generated or the intent of the person that
sent them.

Just consider if you have a script that creates a query for your
database on the client and you simply run it at the server with
out checking or validating anything. Anyone can create whatever
query they like and attempt to run it on your server.

So just let users pick reasonable values in your page and submit
them back to the sever. Perhaps you could offer rate ranges as
a set of radio buttons so users don't enter anything?
--
Rob
Jul 23 '05 #4

P: n/a
In article <d1**********@reader11.wxs.nl>, triotours@*N0SPAM*planet.nl
enlightened us with...
OK, I can see what you mean. :-)

But I was told I could use javascript to "assemble" the right info
client-side on the html page BEFORE sending it to the script.

Only thing is, I have no clue about javascript.


Javascript validation is best used in addition to any server-side validation,
as a courtesy to users who have it enabled so they don't have to wait for the
document to be sent to the server, rejected, and get the message back.

If you do it only with javascript, it's VERY hackable. ;)

If this isn't about validation, then I'm unclear on exactly what you're going
for. I don't see quite what you mean if you wanted javascript to do this:

"The CGI script would then search for a value between 1 and "maxrate" in the
field set by "roomtype", which could be either "single" or "double"."

I'm a bit database-centric in my application viewpoint, since I work with
them all the time. To me, it seems like that's a database search. Which JS
can't do. Am I misunderstanding what you want?

--
--
~kaeli~
Quantum Express: When you absolutely, positively, don't
know where it's going or when it needs to be there.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.