hargz Posted November 26, 2008 Share Posted November 26, 2008 Hi, For my A Level i need to make simple booking script. For example a customer enters there details in a Form and then transfers all the data into a database such as access. Could someone make a simple one for me please so i can see how it's done or tell me how to make it. Would be very appreciated. Many Thanks Sam Hargreaves Year 13 Desborough School Quote Link to comment Share on other sites More sharing options...
ILMV Posted November 26, 2008 Share Posted November 26, 2008 Sorry, I know you want to learn, but you cannot expect someone to do the work for you. there are many examples you can find via google, here is one... http://www.scripts.com/php-scripts/calendar-scripts/online-booking-manager/ I would be happy to help you in the right direction if you told me what you know. Even if it is a basic concept as to how you think it might work. ILMV Quote Link to comment Share on other sites More sharing options...
hargz Posted November 26, 2008 Author Share Posted November 26, 2008 Hi, I'm trying to make a Parcel Booking script so the parcel details are entered and then they can be viewed by a database. I know you can use ASP scripts but unsure how to make it work. If someone showed me a basic script i could break it down and learn how it works and make my own. Many Thanks Sam Quote Link to comment Share on other sites More sharing options...
ILMV Posted November 26, 2008 Share Posted November 26, 2008 Right, input and viewing, is that all you need? With the input its simple, you have a form (with your text boxes on etc)... <html> <body> <form action="insert.php" method="post"> Firstname: <input type="text" name="firstname" /> Lastname: <input type="text" name="lastname" /> Age: <input type="text" name="age" /> <input type="submit" /> </form> </body> </html> Then you need a bit of PHP to insert those values into the database... <?php $con = mysql_connect("localhost","peter","abc123"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("my_db", $con); $sql="INSERT INTO Persons (FirstName, LastName, Age) VALUES ('$_POST[firstname]','$_POST[lastname]','$_POST[age]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con) ?> Do you see how that works, the PHP script is on a page called insert.php, then HTML code can be wherever you want. You will need to configure the field names and the database connection before it will work. When I enter the values into the form and hit submit, the PHP script will connect to the database, use SQL to insert the data into the database and check it was successful. Viewing it is even easier. Please tell us how you managed. Quote Link to comment Share on other sites More sharing options...
Alexhoward Posted November 26, 2008 Share Posted November 26, 2008 Ha! what a question... Could someone make a simple one for me firstly ILMV's given you the basics there, you just need to expand on that, however as you mentioned Access.. i'm left thinking. Do you have PHP installed? Do you have MySQL? If you're asking this, do you know how to get PHP and Access talking to eachother...? Do you have to use PHP for your project, or could you just make it all in Access? If the answer is "No" to the 1st three then i suggest you just use Access, it will be much easier for you Quote Link to comment Share on other sites More sharing options...
hargz Posted November 26, 2008 Author Share Posted November 26, 2008 Yes installed it all Was much easier than i thought it would be. Thanks for the script. How do i now make the view script? Cheers Sam Quote Link to comment Share on other sites More sharing options...
ILMV Posted November 27, 2008 Share Posted November 27, 2008 Modify in the same way... <?php $con = mysql_connect("localhost","peter","abc123"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("my_db", $con); $result = mysql_query("SELECT * FROM Persons"); while($row = mysql_fetch_array($result)) { echo $row['FirstName'] . " " . $row['LastName']; echo "<br />"; } mysql_close($con); ?> By the way, there are loads of examples of this on the internet, this site is a great starting point, fantastic reference also. http://www.w3schools.com/php/php_mysql_select.asp Quote Link to comment Share on other sites More sharing options...
xcoderx Posted November 27, 2008 Share Posted November 27, 2008 ill make u will u pay me? 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.