Jump to content

Recommended Posts

Hi i am a complete newbie to MySqL / php and hope someone can help.  My old website would take bookings (for car parking) and email the details from the form, and input the info into an Access Database.  My new website wich is php based only emails me info from the form, i am looking to get that same info put into a database, if possible my existing access database, if not then a newly created MySql database.  Below is the php page that once clicked emails me the results from the form, i would like that same info put into a database of some sort.  www.ezparking.co.uk/book.php

 

Any help is much appreciated.

Thanks

 

 

 

<? $pagestyle = array("style_book.css"); include "top.php"; if ($_GET['action']=="go"): $to = "bookings@ezparking.co.uk"; $subject = "Website Booking"; $from = "website@ezparking.co.uk"; foreach($_POST as $key => $value): if($key!="submit" && $value!=""): $message .= $key. ":\n" . $value . "\n\n"; endif; endforeach; mail($to, $subject, $message, "From: $from", "-f$from"); ?> <h2>Thanks!</h2>

<p>You should receive your booking within the next 24 hours. For matters of a more urgent nature please feel free to <a href="contact.php">contact us</a>. </p>

<p>Please note: No payment has been taken today payment is to be made on your arrival date or return date by means of cash or cheque. </p>

<? else: ?> <h2>Booking form</h2> <p>Please complete the form as fully as possible. We will contact you to confirm the booking.</p> <form method="post" action="<?=$_SERVER['PHP_SELF']?>?action=go"> <table> <tr> <th width="77">Airport</th> <td colspan="2"><?=htmlentities($_POST['airport'])?> <input type="hidden" name="Airport" value="<?=htmlentities($_POST['airport'])?>" /></td> </tr> <tr> <th>From</th> <td colspan="2"><?=date("d/m/y H:i", $_POST['datefrom'])?> <input type="hidden" name="From date" value="<?=date("d/m/y H:i", $_POST['datefrom'])?>" /></td> </tr> <tr> <th>To</th> <td colspan="2"><?=date("d/m/y H:i", $_POST['dateto'])?> <input type="hidden" name="To date" value="<?=date("d/m/y H:i", $_POST['dateto'])?>" /></td> </tr> <tr> <th>Service</th> <td colspan="2"><?if ($_POST['book_standard']!=""):?>Standard parking<?else:?>VIP Meet and Greet<?endif;?></td> </tr> <tr> <th>Name</th> <td colspan="2"><input type="text" name="Name" value="" /></td> </tr> <tr> <th>Email</th> <td colspan="2"><input type="text" name="Email" value="" /></td> </tr>

    <tr>

      <th>Car Make </th>

      <td colspan="2"><input name="Car Make" type="text" id="Car Make" value="" /></td>

    </tr>

    <tr>

      <th>Car Model </th>

      <td colspan="2"><input name="Car Model" type="text" id="Car Model" value="" /></td>

    </tr>

    <tr>

      <th>Colour</th>

      <td colspan="2"><input name="Car Colour" type="text" id="Car Colour" value="" /></td>

    </tr>

    <tr>

      <th>Reg</th>

      <td colspan="2"><input name="Car Reg" type="text" id="Car Reg" value="" /></td>

    </tr>

    <tr>

      <th>Flight No </th>

      <td colspan="2"><input name="Flight No" type="text" id="Flight No" value="" /></td>

    </tr>

    <tr>

      <th>Destination</th>

      <td colspan="2"><input name="Dest" type="text" id="Dest" value="" /></td>

    </tr>

    <tr>

      <th>Telephone</th>

      <td colspan="2"><input type="text" name="Telephone" value="" /></td>

    </tr>

    <tr> <th rowspan="2">Confirm</th>

      <td width="115"><div align="center">VIP

      Parking        </div></td>

      <td width="159"><input name="VIP" type="checkbox" id="VIP" value="checkbox"></td>

    </tr>

    <tr>

      <td><div align="center">Standard Parking      </div></td>

      <td><input name="STANDARD" type="checkbox" id="STANDARD2" value="checkbox"></td>

    </tr>

    <tr> <th></th> <td colspan="2"><input type="submit" value="Book now" class="button" /></td> </tr> </table>

</form><? endif; include "bottom.php"?>

Link to comment
https://forums.phpfreaks.com/topic/77372-newbie-how-to-write-to-a-mysql-database/
Share on other sites

With decent formatting and code tags, you might get someone to read that.

 

I just copied and pasted, i agree it doesn't look neat! is this link any better http://www.ezparking.co.uk/book.txt

 

If anyone can help i'd be happy to email the actual php file.

 

Thanks in advance

 

Yeah, sorry, the link is no better. As Barand has pointed out, you really need to make an effort to make your code readable before people will read it.

 

I could post an example of how to insert to a database, but its been done before. Theres a link in my signiture to a free book, read the part on databases and you should be able to get this together yourself.

 

Post again if you have any questions.

Yeah, sorry, the link is no better. As Barand has pointed out, you really need to make an effort to make your code readable before people will read it.

 

I could post an example of how to insert to a database, but its been done before. Theres a link in my signiture to a free book, read the part on databases and you should be able to get this together yourself.

 

Post again if you have any questions.

 

Thanks i have started to read the database section of your book.  Before i start digging a great big hole, can someone point me in the right direction as far as a database is concerned, as mentioned i currently use an access database.  I understand that i will have to use a Mysql database, so i guess my question is; is this free, where can i get it, where does it reside?  My isp 'supanames' provides me with 1 mysql database does anyone know if this is sufficient?

 

Thanks for any help, and the help so far.  I'll get there in the end.

 

Any copy and paste code that i can experiment with would be a great help too.

 

Thanks

 

 

One db can be a bit restrictive but you can always prefix your tablenames to group them by client or application.

 

I'd certainly go to www.mysql.com and download a copy to install on your PC so you can develop and test separatle from your hosted one.

 

While you're at it, download their MySQL Adminitrator and Query Browser programs too.

One db can be a bit restrictive but you can always prefix your tablenames to group them by client or application.

 

I'd certainly go to www.mysql.com and download a copy to install on your PC so you can develop and test separatle from your hosted one.

 

While you're at it, download their MySQL Adminitrator and Query Browser programs too.

 

Thanks, i've downloaded MySQL and the admin/query programs, i can connect to the database etc.  Where do i actually create tables etc, can this only be done via the command line.  I want a good old gui like MS access.

 

Thanks for any help

 

 

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.