Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Seat reservation question

Status
Not open for further replies.

Blutch

IS-IT--Management
Sep 19, 2002
203
BE
I'm new to php, but I want to setup a seat reservation program.
The only thing I want is when they push a seat it turns color from red to green. therefore I use two jpegs and two functions (who doesn't seem to do it - naargroen() and naarrood().)
My problem is I want to call a function which does that.

My script can be found at (changed the name for easier reading)

Thx for any help.
 
Hell, maybe.

However I need to pass the current pointer in the database so I can change the database.

I've tried it in javascript, but maybe someone can tell me how to do it in php, or isn't that possible??

I will ask the same question in the javascript forum.

If there is still someone who can lend a hand, I'll be grateful.
 
you asked to be able to change the colour of a seat in response to a click event. that's a javascript/css/html question.

are you now asking for the click also to change a value in the database?

if so, that could well be a php question.
 
If you change the color from JavaScript and THEN put the reservation into the database, then more people can claim the same seat at the same time can't they?

I would do the whole thing on the server. The database can separate simultaneous calls and therefore guarantee that only one person registers the seat.

Yuo could use php to do that, but do not think it will be easy to do that is you are complete new to the language. From php, you can either create a "dynamic" image, or output "dynamic" HTML with positioned seat images.
 
Well, for starters it would only be the different people handling the reservations who would change those (after phone, e-mail,...) on the website. So no one else is allowed and therefor it will not be changed a second time. So no error handling of any kind needed there.

As you could see in the script I call a javascript function which need to change the value of a field in the mysql database and do a refresh of the page (or something like that) so the page shows the right colors/jpegs/reservations.

Can I do this in javascript, do I need php, can it be done just by using php???? All questions, but the most important how can it be done.
 
I would recommend that you look at using AJAX for the page. This way everyone can see the change without having to refresh.

PHP is server-side only. Which means to affect the database, you have to post the data; which means changing pages. For example, you click the seat, it calls a js function to post a window.location to an update script with the ON value for that seat. The update script can then refresh back to the original page. (This can all be done within one page by posting the data to the same page and performing the update before you select the values for that page). Either way, it can't be done without refreshing the page.

With AJAX, the javascript calls external PHP functions without leaving the page to perform the update as well as showing it on your screen. The other users of that page also get the update without having to refresh.

My $.02

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top