logo-dw

Go Back   Dreamweaver Club Forums > Dreamweaver forums > Dreamweaver General
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 04-19-2015, 09:12 PM   #1
gilberto
 
Join Date: Apr 2015
Posts: 5
Default want to know the logic

I'm a newbie to create a website. I want to build a website for a cinema including a seat reservation function. The function is that customer can first choose the film and timeslot they want to watch. After clicking in, there is a seat plan for customer to choose their preferred seat . Then it will consist of the payment part. if customer B choose the same seat as customer A choosed at the same timeslot and movie, it will pop up an error. Will it consist of the database?

I have no idea about the logic of designing this function.
there are lots of questions i can't figure out.
how to create a seatplan for customers to choose and how the website can recognize the seat is already taken by someone in the same timeslots?


Please help.
gilberto is offline   Reply With Quote
Old 04-20-2015, 01:14 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

logic is with a database i would suggest.
a table would consist of
1 seat number
2 time slot
3 booked/confirmed yes or no (0 or 1 perhaps}
insert on condition not equal to time and if booked = no
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 04-20-2015, 06:28 AM   #3
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

or try modify thois open souce script http://www.openmyseat.com
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 04-20-2015, 06:30 PM   #4
gilberto
 
Join Date: Apr 2015
Posts: 5
Default

Thanks A lot!!! It really helps me.
right now i have created a table including all seats number
A1 A2 A3
B1 B2 B3
C1 C2 C3
.....

and below the table i have a form including a textfield and submit button.
is it possible if i click on the seat number in the table, the seat number i clicked will be shown on a textfield in the form?
gilberto is offline   Reply With Quote
Old 04-21-2015, 12:59 AM   #5
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

yes, use the seat selection in a form itself then collect the value by $_post or $_get
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 04-21-2015, 09:19 PM   #6
gilberto
 
Join Date: Apr 2015
Posts: 5
Default

Thanks !!!! but im confused of using it. I have created 4 buttons and assigned seat numbers as a value on each button. For example, if A2 button is clicked, it will shift to the next page and display the value passed from the first page. but my code doesnt work and seesion seems not work here.
help would be very appreciated!!

<?php
session_start();

static $_SESSION[$x]=A;
static $_SESSION[$y]=1;

//loop for checking which button is clicked and pass the value to next page
while($x<C){
if(isset($_POST[$x.$y])){
'value'=$_SESSION[$_POST[$x.$y]];
}
$y++;

//next row
if($y%3){
$y==0; //
$x++;
}

}
?>

<body>

<div id="CONTENT">


<div id="A1" class="unit" style="left: 310px; top: 350px;"
<form action ="payment.php" method ="post">
<input type="submit" name="A1" value="A1">
</form>
</div>


<div id="A2" class="unit" style="left: 345px; top: 350px;">
<form action ="payment.php" method ="post">
<input type="submit" name="A2" value="A2" >
</form>
</div>

<div id="B1" class="unit" style="left: 310px; top: 385px;">
<form action ="payment.php" method ="post">
<input type="submit" name="B1" value="B1" >
</form>
</div>

<div id="b2" class="unit" style="left: 345px; top: 385px;">
<form action ="payment.php" method ="post">
<input type="submit" name="B2" value="B2" >
</form>
</div>
</div>


payment.php
<body>
<?php
echo $_POST['value'];
?>
</body>
gilberto is offline   Reply With Quote
Old 04-22-2015, 01:03 AM   #7
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

Code:
static $_SESSION[$x]=A;
static $_SESSION[$y]=1;
why static? the usage for that is in a class.

Code:
//loop for checking which button is clicked and pass the value to next page
while($x<C){
if(isset($_POST[$x.$y])){
'value'=$_SESSION[$_POST[$x.$y]];
}
$y++;

//next row
if($y%3){
$y==0; //
$x++;
}

}
what is the purpose of that?
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 04-22-2015, 03:56 AM   #8
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

here are your buttons, action set to itself so you can see the 4_post value being sent
Code:
<body>
<div id="A1" class="unit" style="left: 310px; top: 350px;"></div>
<form action =" " method ="post">
<input type="submit" name="A1" value="A1">
</form>
</div>


<div id="A2" class="unit" style="left: 345px; top: 350px;">
<form action ="" method ="post">
<input type="submit" name="A2" value="A2" >
</form>
</div>

<div id="B1" class="unit" style="left: 310px; top: 385px;">
<form action =" " method ="post">
<input type="submit" name="B1" value="B1" >
</form>
</div>

<div id="b2" class="unit" style="left: 345px; top: 385px;">
<form action =" " method ="post">
<input type="submit" name="B2" value="B2" >
</form>
</div>
</div>


payment.php
<body>
<?php
print_r($_POST);
?>
</body>
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 04-22-2015, 05:49 AM   #9
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

If you use $_GET you can use an image fo the seat
Code:
<a href="<?php $_SERVER['PHP_SELF'];?>?seat=A1"> <img src="images/general/favicon.ico" > 
A1 </a>
<br>
<a href="<?php $_SERVER['PHP_SELF'];?>?seat=A2"> <img src="images/general/favicon.ico" > 
A2 </a>
<br>

<a href="<?php $_SERVER['PHP_SELF'];?>?seat=A3"> <img src="images/general/favicon.ico" >
A3 </a>
<br>
<?php
print_r($_GET);
?>
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 04-22-2015, 08:02 AM   #10
gilberto
 
Join Date: Apr 2015
Posts: 5
Default

Thanks a lot! Finally I successfully passed the value from the button to other page. But I experience another problem in which for example I click on A2, it shows (array([A2]=>A2). However, I just want to show the value "A2" in the page without the array.
Here are the codes that I have.
Quote:
<div id="A1" class="unit" style="left: 310px; top: 350px;">
<form action="payment.php" method="post">
<input type="submit" name="A1" value="A1" class="seatbutton">
</form>
</div>


<div id="A2" class="unit" style="left: 345px; top: 350px;">
<form action="payment.php" method="post">
<input type="submit" name="A2" value="A2" class="seatbutton">
</form>
</div>

<div id="B1" class="unit" style="left: 310px; top: 385px;">
<form action="payment.php" method="post">
<input type="submit" name="B1" value="B1" class="seatbutton">
</form>
</div>

<div id="b2" class="unit" style="left: 345px; top: 385px;">
<form action="payment.php" method="post">
<input type="submit" name="B2" value="B2" class="seatbutton">
</form>
I am trying to make some buttons for the seats in a php and pass the value of the buttons clicked to payment.php.
Thanks for your reply in advance.
gilberto is offline   Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 02:44 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com