I have a database named "Restarants" with a table named "Pizzerias" that has the following fields: RestaurantID int(11) RestaurantLocationID int(11) Name varchar(75) Address1 varchar(30) Address2 varchar(20) City varchar(30) State char(2) Zip varchar(5) PhoneMain varchar(10) PhoneToll varchar(10) Phone varchar(10) Fax varchar(10) Fax2 varchar(10) URL varchar(60) Email varchar(40) I need a form that I can use to pull records from the table correct them then send submit them back to the table. The form can also be used to add other records to the table. Please someone help Thank you SOOOOOOOOOOO much
i would suggest you to start with code... and if you get errors then tell us where you need help... asking to make the entire thing (free) is too much to ask for according to me...
Thank you so much for writing back. I made most of the code but it's not working. I am building a new form now and will post the code here shortly.
Hello again, Well I have three files, the config.php, index.php and contact_insert.php here is the code for the index.php: <HTML> <Head> <title>Contact form</title> <style type="text/css"> table{ border:1; border-collapse:collapse; font: normal 12px 'Lucida Grande',Verdana,sans-serif; } td{ color:#663333;font-family:verdana; border-bottom: 1px solid #666; padding-left:10px; background-color:#F0F8FF; } #sub{ text-align:center;} </style> </Head> <body> <h2>Please use this Form to Add a new Restaurant</h2> <form action="contact_insert.php" method="POST" id="insert"> <table> <tr> <td >Restaurant ID</td> <td ><input type="text" size=40 name="RestaurantID"></td> </tr> <tr> <td >Restaurant Location ID</td> <td ><input type="text" size=40 name="RestaurantLocationID"></td> </tr> <tr> <td >Name*</td> <td ><input type="text" size=40 name="Name"></td> </tr> <tr> <td >Address 1</td> <td ><input type="text" size=40 name="Address1"></td> </tr> <tr> <td >Address 2</td> <td ><input type="text" size=40 name="Address2"></td> </tr> <tr> <td >City</td> <td ><input type="text" size=40 name="City"></td> </tr> <tr> <td >State</td> <td ><input type="text" size=15 name="State"></td> </tr> <tr> <td >Zip</td> <td ><input type="text" size=20 name="Zip"></td> </tr> <tr> <td >Phone Main</td> <td ><input type="text" size=40 name="PhoneMain"></td> </tr> <tr> <td >Phone Toll</td> <td ><input type="text" size=40 name="PhoneToll"></td> </tr> <tr> <td >Phone</td> <td ><input type="text" size=40 name="Phone"></td> </tr> <tr> <td >Fax</td> <td ><input type="text" size=40 name="Fax"></td> </tr> <tr> <td >Fax2</td> <td ><input type="text" size=40 name="Fax2"></td> </tr> <tr> <td >URL</td> <td ><input type="text" size=60 name="URL"></td> </tr> <tr> <td >Email</td> <td ><input type="text" size=40 name="Email"></td> </tr> <tr> <td colspan=2 id="sub"><input type="submit" name="submit" value="submit" ></td> </tr> </Table> </form> </BODY> </Html> Code (markup): and here is the code for the contact_insert.php <?php include('config.php'); ?> <?php //Get data in local variable $v_RestaurantID=$_POST['RestaurantID']; $v_RestaurantLocationID=$_POST['RestaurantLocationID']; $v_Name=$_POST['Name']; $v_Address1=$_POST['Address1']; $v_Address2=$_POST['Address2']; $v_City=$_POST['City']; $v_State=$_POST['State']; $v_Zip=$_POST['Zip']; $v_PhoneMain=$_POST['PhoneMain']; $v_PhoneToll=$_POST['PhoneToll']; $v_Phone=$_POST['Phone']; $v_Fax=$_POST['Fax']; $v_Fax2=$_POST['Fax2']; $v_URL=$_POST['URL']; $v_Email=$_POST['Email']; // check for null values if ($v_Name=="" or $v_Zip=="") echo "All fields must be entered, hit back button and re-enter information"; else{ $query="insert into restaurants (RestaurantID,RestaurantLocationID,Name,Address1,Address2,City,State,Zip,PhoneMain,PhoneToll,Phone,Fax,Fax2,URL,Email) values('$RestaurantID' , '$RestaurantLocationID' , '$Name' , '$Address1' , '$Address2' , '$City' , '$State' , '$Zip' , '$PhoneMain' , '$PhoneToll' , '$Phone' , '$Fax' , '$Fax2' , '$URL' , '$Email')"; mysql_query($query) or die(mysql_error()); echo "Your message has been received"; } ?> Code (markup): Please help me
everything is working fine with me... considering that in config.php you have taken the connection to the database e.g. mysql_connect("localhost", "databse_usr", "passss") or die(mysql_error()); mysql_select_db("database_name") or die(mysql_error()); PHP: Edit : Don't forget to handle sql injections using mysql_real_escape_string()
I want to be able to enter a search term for example a zip code. Then after the results are displayed I want to click on the restaurant listing that needs to be corrected. After I click on the restaurant that needs to be corrected, all restaurant information will be placed in a form. Then after I correct what needs to be corrected click the Submit button to submit the corrections to the Database. I already have the search script. please go to this page and search for zip code 73118 for example: http://123pizzadelivery.com/test All I need is the script to pull the restaurant information a paste it in a form to be corrected. How do I do that please?