Jump to content

Simple booking script


hargz

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.