i have 2 forms here.
1) DisplayDetails.php
2) RegistrationForm.php
when user click to the link 'Next' at the DisplayDetails.php page it will bring
all the session value to the RegistrationForm.php page. But, there's also value which is not session which is
i) $room_type
so, at the RegistrationForm, i wanted to passed all the values from the DisplayDetails.php into mysql query
to insert into database.After i test it, all the data work fine including the session values from DisplayDetails.php.
The only problem is, value which is i) $room_type
that i got from the query in the DisplayDetails.php as the only that
unsuccessfully inserted into the database.
So, the question is, is it possible for me to get value from the DisplayDetails.php page into
RegistrationForm.php page query so that i can insert the value into database.
below is the code for DisplayDetails.php -
-
<?php
-
session_start();
-
//echo "<pre>";
-
//var_dump($_SESSION);
-
//echo "</pre>";
-
-
$id_no=$_GET['id_no'];
-
-
-
$query="SELECT * from room1 WHERE id_no=$id_no";
-
-
$result=mysql_query($query);
-
-
//Get the number of rows in array for loop
-
$num=mysql_numrows($result);
-
-
mysql_close();
-
-
$i=0;
-
while ($i < $num) {
-
$id_no=mysql_result($result,$i,"id_no");
-
$room_no=mysql_result($result,$i,"room_no");
-
$room_type=mysql_result($result,$i,"room_type");
-
$qty=mysql_result($result,$i,"qty");
-
$room_price=mysql_result($result,$i,"room_price");
-
-
//echo "$id_no - $room_no - $room_type - $qty - $rom_price";
-
-
$i++;
-
}
-
-
?>
-
-
<body>
-
<h3><center>
-
Room's Reservation
-
</center></h3>
-
<form action="DisplayDetails.php" method="post">
-
-
<table width="373" border="1">
-
<tr>
-
<td colspan="2"><strong>Reservation Summary</strong></td>
-
</tr>
-
<tr>
-
<td>Check In :</td>
-
<td><label> <?php echo $_SESSION['checkin']; ?> </label></td>
-
</tr>
-
<tr>
-
<td>Check Out :</td>
-
<td><label><?php echo $_SESSION['checkout']; ?></label></td>
-
</tr>
-
<tr>
-
<td>Rooms :</td>
-
<td><label><?php echo $_SESSION['rooms']; ?></label></td>
-
</tr>
-
<tr>
-
<td>Adults Per Room :</td>
-
<td><label><?php echo $_SESSION['adults']; ?></label></td>
-
</tr>
-
<tr>
-
<td>Children Per Room :</td>
-
<td><label><?php echo $_SESSION['children']; ?></label></td>
-
</tr>
-
<tr>
-
<td>Days :</td>
-
<td><?php echo $_SESSION['days']; ?></td>
-
</tr>
-
<tr>
-
<td>Room Type</td>
-
<td><?php echo $room_type; ?></td>
-
</tr>
-
<tr>
-
<td>Room Price</td>
-
<td><?php echo $room_price; ?></td>
-
</tr>
-
<tr>
-
<td>TOTAL PRICE :</td>
-
<td><?php $total =$_SESSION['days'] * $room_price;
-
echo $total;?> </td>
-
</tr>
-
</table>
-
<label>
-
<input type="submit" name="submit" id="submit" value="submit" />
-
</label>
-
<a href="RegistrationForm.php"><strong>
-
Next >> </strong></a>
-
</form>
-
</body>
-
</html>
-
-
below is the code for RegistrationForm.php -
<?php
-
session_start();
-
?>
-
<html>
-
<body>
-
-
<form action="RegistrationForm.php" method="post">
-
-
<p><strong>REGISTRATION FORM</strong></p>
-
-
<table width="285" border="1">
-
<tr>
-
<th width="120" scope="row">Name :</th>
-
<td width="149"><label>
-
<input type="text" name="name" id="name" value="<?php $name; ?>"/>
-
</label></td>
-
</tr>
-
<tr>
-
<th scope="row">Ic No :</th>
-
<td><label>
-
<input type="text" name="ic_no" id="ic_no" value="<?php $ic_no; ?>">
-
</label></td>
-
</tr>
-
<tr>
-
<th scope="row">Contact No :</th>
-
<td><label>
-
<input type="text" name="contact_no" id="contact_no" value="<?php $contact_no; ?>">
-
</label></td>
-
</tr>
-
<tr>
-
<th scope="row">Email :</th>
-
<td><label>
-
<input type="text" name="email" id="email" value="<?php $email; ?>">
-
</label></td>
-
</tr>
-
<tr>
-
<th scope="row">Gender :</th>
-
<td><label>
-
<select name="gender" id="gender" value="<?php $gender; ?>">
-
<option>female</option>
-
<option>male</option>
-
</select>
-
</label></td>
-
</tr>
-
<tr>
-
<th scope="row">Username :</th>
-
<td><label>
-
<input type="text" name="username" id="username" value="<?php $username; ?>">
-
</label></td>
-
</tr>
-
<tr>
-
<th scope="row">Password :</th>
-
<td><label>
-
<input type="text" name="password" id="password" value="<?php $password; ?>">
-
</label></td>
-
</tr>
-
</table>
-
<p>
-
</p>
-
<p>
-
<label>
-
<input type="submit" name="submit" id="submit" value="Submit">
-
</label>
-
-
<?php
-
-
-
$room_type=$_POST['room_type'];
-
-
$sql="INSERT INTO reservation1
-
(name,ic_no, gender,checkin,checkout,
-
room_type)
-
VALUES
-
('$_POST[name]','$_POST[ic_no]','$_POST[gender]','$_SESSION[checkin]','$_SESSION[checkout]',
-
'$_POST[room_type]')";
-
?>
-
-
</p>
-
</form>
-
-
</body>
-
</html>
-
-
Hello,
I had look over your code and think that you have make mistake in DisplayDetails.php line number 18. mysql_close(); which should be end of the page. Also there is no database connection in RegistrationForm.php. Also you have not assign room_type to session or retrieve it from session make sure for that.
Regards,
Mayur Bhayani
2 3178
Hello,
I had look over your code and think that you have make mistake in DisplayDetails.php line number 18. mysql_close(); which should be end of the page. Also there is no database connection in RegistrationForm.php. Also you have not assign room_type to session or retrieve it from session make sure for that.
Regards,
Mayur Bhayani
Thanks Mayur2007. your comment did really help me. I already solved the problems..thankz for spending time to check my code..:)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: lawrence |
last post by:
A very strange bug. www.monkeyclaus.org is run by a cms I'm
developing. One of types of users we allow is "justTestingTheSite", a
type of user I developed to give demo's to prospective clients. The...
|
by: jason |
last post by:
How does one loop through the contents of a form complicated by dynamic
construction of checkboxes which are assigned a 'model' and 'listingID' to
the NAME field on the fly in this syntax:...
|
by: shank |
last post by:
I have a recordset that contains multiple records of product a user is
purchasing. For clarity, I converted the recordset fields to variables. I
need to take that entire recordset and insert it...
|
by: PT |
last post by:
I got a problem. And thats.....
First of all, I got these three tables.
------------------- ------------------ ----------------------
tblPerson tblPersonSoftware ...
|
by: Geoffrey KRETZ |
last post by:
Hello,
I'm wondering if the following behaviour is the correct one for
PostGreSQL (7.4 on UNIX).
I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching
the following request :...
|
by: robecflo |
last post by:
Hi Forum, i have a problem, hope somebody can give me ideas. I'm
developing with windows forms and vb.net, and oracle as a database. At
this moment i have a table called amortizaciones, this table...
|
by: underground |
last post by:
I wonder if possible on page load to query the value of a specific colmn and insert the result into another table. My query looks like so
<?
include("include/session.php");
?>
<?
$usr =...
|
by: rn5a |
last post by:
During registration, users are supposed to enter the following
details: First Name, Last Name, EMail, UserName, Password, Confirm
Password, Address, City, State, Country, Zip & Phone Number. I am...
|
by: Bob |
last post by:
Hi all,
I'm trying to import data, modify the data then insert it into a new
table. The code below works fine for it but it takes a really long
time for 15,000 odd records. Is there a way I...
|
by: rn5a |
last post by:
In a ASP applicatiuon, the FOrm has a textbox & a select list where
the admin can select multiple options. Basically the admin has to
enter the name of a new coach in the textbox & select the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |