As part of my college task I need to make simple webpage based on PHP and MySQL which goes exactly like this:
Since I am still newbie, I hope you can help me with this one. For practicing I use EasyPHP and this is what I done till now:
1. First I created page index.html which looks like this:
<html> <head></head> <body> <form action = 'processor.php' method = 'post'> <b>Hamburger*:</b> <br /> <select name = 'hamburger'> <option value = ''>-select one-</option> <option value = '4'>Cheeseburger (4.00 USD)</option> <option value = '7'>Hamburger (7.00 USD)</option> <option value = '8'>McDouble (8.00 USD)</option> <option value = '10'>BIG MAC (10.00 USD)</option> </select> <p /> <b>Extra stuff*:</b> <br /> <select name = 'additions'> <option value = ''>-select one-</option> <option value = '1'>Salad (1 USD)</option> <option value = '0.5'>Catchup (0.5 USD)</option> <option value = '1'>Muster (1. USD)</option> </select> <p /> <p /> <input type = 'submit' name = 'submit' value = 'Submit'> </form> </body> </html>
2. Then I created MySQL database called "newdb" and I grant all privilegs to user "root"
3. I created file processor.php which looks like this:
<?php $pizza = $_POST['hamburger']; $additions = $_POST['extrastuff']; // set database server access variables: $host = "localhost"; $user = "root"; //$pass = "test"; $db = "newdb"; // open connection $connection = mysql_connect($host, $user) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); $query = "insert into orders('$hamburger','$extrastuff')"; $result = mysql_query($query); ?>
I now that there are lot of misteks in these files and that it will take much more work to make this task work but this what I done so far and I every help/suggestion from you is appreciated. Also try to find some free similar tutorials/lessons on Web which would help solve my problem but I couldn't find to much so if you have some good quality website with good tutorals to recommend, it would be of great help
Any help is apprecated andmany thanks in advance for promt replys.