edoplaza Posted August 27, 2009 Report Share Posted August 27, 2009 Hello, I need some help here. I am going to build a Web site about a little hotel. It is actually a house with 6 rooms, nothing more. The client wants a reservation page, with simple information like: Name, telephone number, e-mail, dates of check-in and check out, number of rooms, gests per room, etc. I'm just concerned with two things: 1. For the dates, I'd like to add a calendar button, something like this: http://ww w.holidayinn.com/h/d/hi/1/en /home# 2. I'd like to display the total total amount at the end of the reservation Regards, Eduardo Quote Link to comment Share on other sites More sharing options...
edoplaza Posted August 27, 2009 Author Report Share Posted August 27, 2009 Also, After the user submits the information, I'd like him to see a feedback page just showing the information he just submitted. How can I tell php to fetch just that specific row? Quote Link to comment Share on other sites More sharing options...
bishwadeep Posted August 28, 2009 Report Share Posted August 28, 2009 (edited) Hi edoplaza, if you want to display the information in the same page where you insert your data then user mysql_insert_id() after you run your insert query which fetches the lates id of data inserted. If you wish to show the information in different pages then you can do the following. <?php session_start(); //add a new row called sessionid in the table and while inserting the value put session_id() for it. //eg: insert into your table (name,address,sessionid) values ("abc","bcd",'".session_id()."'); //then you can take out that record from the database any time until the user closes his browser. //eg: select * from your table where sessionid='".session_id()."'; ?> Remember that this sessionid is valid for only once, this session id is always different for every user and is valid for only one user session. Edited August 28, 2009 by bishwadeep Quote Link to comment Share on other sites More sharing options...
edoplaza Posted August 28, 2009 Author Report Share Posted August 28, 2009 Put your information here: Name: Lastname: Quote Link to comment Share on other sites More sharing options...
bishwadeep Posted August 31, 2009 Report Share Posted August 31, 2009 (edited) Put your information here: Name: Lastname: Edited August 31, 2009 by bishwadeep Quote Link to comment Share on other sites More sharing options...
edoplaza Posted August 31, 2009 Author Report Share Posted August 31, 2009 Hey, thank you very much, now I understand what you mean. However when I test the pages it gives me this: Warning: Cannot modify header information - headers already sent by (output started at /home5/musicaen/public_html/puntabahareque/reservation1.php:4) in /home5/musicaen/public_html/puntabahareque/reservation1.php on line 51 I put 2 new pages with your code: http://www.puntabahareque.com/reservation1.php and http://www.puntabahareque.com/feedback1.php I checked line 51 and it has this code: header(sprintf("Location: %s", $insertGoTo)); I don't know what that means Regards, Eduardo Quote Link to comment Share on other sites More sharing options...
bishwadeep Posted September 1, 2009 Report Share Posted September 1, 2009 HI edoplaza, I think you have a space before your <? starting tag. This type of warning message generally arises when there is a space before the opening tag. ----------------------------------------------- ELIMINATE SPACE HERE <? ?> ----------------------------------------------- Quote Link to comment Share on other sites More sharing options...
edoplaza Posted September 1, 2009 Author Report Share Posted September 1, 2009 Thank you very much! Now it works. The only problem is that the feedback page is still showing the first line of the DataBase. I checked on PHPmyAdmin and the information is being updated correctly, I mean, when you enter a new name and last name, they appear on the database but not on the feedback page. Thanks again Eduardo Quote Link to comment Share on other sites More sharing options...
bishwadeep Posted September 2, 2009 Report Share Posted September 2, 2009 (edited) Hi edoplaza, This is because you have test the page several time using the same session. In real time this will not be the case. the user will fill the form once and he will close the browser. if you want to use the page in the realtime mode then you have to clear the browser cookie and session each time after filling the form. Currently you might notice that there might be same sessionid for different records in the database. This is because you are filling the form multiple times in the same user session. Edited September 2, 2009 by bishwadeep Quote Link to comment Share on other sites More sharing options...
edoplaza Posted September 2, 2009 Author Report Share Posted September 2, 2009 Thank you very much for your help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.