Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 08-21-2004, 08:14 PM   #1 (permalink)
virtualGeorge
Registered User
 
Join Date: Aug 2004
Posts: 3
virtualGeorge is on a distinguished road
populate form field

I have a form here www.ajguide.com/form/srequest.php
Here is the souce pasted onto a webpage if it helps
www.ajguide.com/form/source.htm
On this reservation form you select arrival & departure dates and this populates a select box where you choose from a list of different priced rooms.

Now I want to be able to populate the next select box based on which room was selected. Some rooms may have 2 queen beds or 1 king bed or some may only have 1 king availble so I want to be able to select bed types based on what room was selected?

Is this easy to add in or do I need to pay someone to do it for me?

Thanks,
-George
virtualGeorge is offline   Reply With Quote
Old 08-22-2004, 07:51 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,490
sde is on a distinguished road
i don't know how proficient you are with javascript or php, so i can't answer that last question, .. but there are a couple ways you could do it.

if you don't want the page to refresh after they make the first selection, then you need to use javascript. you will have to write a function which executes 'onchange' of the first select box.

that would reload the second select box with the information based on the first one. remember if you go this route everything will be client side, so you will have to create all the information for all selections from php and print them to a javascript format.

the second option would be to make the entire page reload when you change the first select box. you could make the form submit in the onchange event of the first select box.

i don't have time to write an example, but if this doesn't make too much sense, then it may be best to hire someone.

good luck =)
__________________
Mike
sde is offline   Reply With Quote
Old 08-22-2004, 11:59 PM   #3 (permalink)
virtualGeorge
Registered User
 
Join Date: Aug 2004
Posts: 3
virtualGeorge is on a distinguished road
I got the form almost the way I need it.
I have a button to clear the dates at the top of the form. After I converted from html to php I did something wrong & now it no longer clears those fields. Any tips on how to make the button clear dates?
Or if the clear date button could just reload the page without caching which would also work? I'm not sure how it works but if I hit refresh on the browser to reload the page, the data in the date fields remain.
Form & source:
www.ajguide.com/form/srequest.php
www.ajguide.com/form/source.htm

Thanks again,
-George
virtualGeorge is offline   Reply With Quote
Old 08-23-2004, 04:20 AM   #4 (permalink)
idx
Senior Grasshopper
 
idx's Avatar
 
Join Date: Jun 2003
Location: FL
Posts: 317
idx is on a distinguished road
Check your JS errors. I get:
Quote:
Error: document.getElementById("inFromStr") has no properties
Source File: http://www.ajguide.com/form/srequest.php
Line: 24
Looks like the dates have a "check_in" and "check_out" ID assigned, so since you're using getElementById, you should probably use those ID's instead of `inFromStr`, etc..

Code:
function clearDates()
{
	document.getElementById('Check_In').value = "";
	document.getElementById('Check_Out').value = "";
	day_bottom="";
	day_top="";
}
PS - I personally wouldn't book a hotel/golf package online via an unencrypted form that is posting to an "email" labeled page. (perhaps it will be encrypted down the road..?)

-r
idx is offline   Reply With Quote
Old 08-23-2004, 08:05 AM   #5 (permalink)
virtualGeorge
Registered User
 
Join Date: Aug 2004
Posts: 3
virtualGeorge is on a distinguished road
Quote:
Originally posted by idx

PS - I personally wouldn't book a hotel/golf package online via an unencrypted form that is posting to an "email" labeled page. (perhaps it will be encrypted down the road..?)

-r
This form will be encrypted on another server. I just put it here for testing purposes. I don't know if it was a coincidince or what, but I had another form I was asking for help on & somehow people gained access to my account and used it to ftp a bunch of thier crap up tom server for downloading to others & used up all the space.

I just realized that the clear date works in IE, I was testing it in Mozilla & the clear date function did not work.

Thanks!
-George
virtualGeorge is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML form preview then INSERT using PHP & MySQL SteveSoler PHP 14 Today 03:45 AM
EMERGENCY: Dynamic form processing DavH27 PHP 8 10-27-2004 07:52 PM
Multiple Entry Fields for One Database Field heartsoh HTML, XML, Javascript, AJAX 0 07-12-2004 08:54 PM
reading a web form for input variables sde PHP 3 08-12-2003 10:02 AM
Passing form data to PHP with Javascript bdl PHP 5 07-03-2002 10:18 AM


All times are GMT -8. The time now is 04:58 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting