I am fairly new at web developement. I created a web site for the dealership in which the dealer can list used motorcycles for sale along with a picture of the motorcycle. Currently, the client emails me the year and model information, the asking price, and a jpg picture file of the motorcycle. I then update the web page with this information. The client asked me to set up a web form which would allow him to upload this information himself and have it automatically listed on the web page. I am php beginner and would like some suggestions on how to go about creating a web page to allow the client to be able to upload the information and then use that information to update the existing web page. I used Microsoft Expressions 3 to develope the web site. I assume that I would have to use a MySQL database to store the uploaded information and link to the picture file.

6 Years
Discussion Span
Last Post by bikertz

Ok so you need to do something along the lines of mysql. Does the webserver have mysql databases? If you want i can write you a script that will insert the stuff into a mysql database and then ill have another script display the results.


I'm working on a script for you right now, just hold on :)

Edited by G&G Designing: n/a


Here you go... you need to setup a mysql database, and then within that make a table with the following names, "year" "price" "img" "model" - without the quotes ofcourse. If you want me to tell you how to echo them out, just ask :)

$hostname = "localhost"; // usually is localhost, but if not sure, check with your hosting company
$db_user = "username"; // change to your database username
$db_password = "passwd"; // change to your database password 
$database = "databse"; // provide your database name 
$db_table = "table_name"; //name of the databases table

$db = mysql_connect($hostname, $db_user, $db_password); 
<title>Insert Info</title> 

if (isset($_REQUEST['Submit'])) { 
$sql = "INSERT INTO $db_table(year,price,model,img) values ('".mysql_real_escape_string(stripslashes($_REQUEST['year']))."','".mysql_real_escape_string(stripslashes($_REQUEST['price']))."','".mysql_real_escape_string(stripslashes($_REQUEST['img']))."','".mysql_real_escape_string(stripslashes($_REQUEST['model']))."')";
if($result = mysql_query($sql ,$db)) { 
echo '<h2>Thank you</h2><br>The bike information was entered into the database.'; 
} else { 
echo "ERROR: ".mysql_error(); 
} else { 
<form method="post" action=""> 
<input type="text" name="year"> 
Price: <br> 
<input type="text" name="price"> 
Img URL:<br>
<input type="text" name="img">
Model Description:<br>
<input type="text" name="model">
<input type="submit" name="Submit" value="Submit"> 

Let me know if you get any errors, didn't test it!

Edited by G&G Designing: n/a


Thank you for your prompt help. I'll have to wait until Monday to find out if the host has MySQL, but I'm pretty sure they do.

Your code gives me a good starting point to get this project started. I realize now that this will be a little more complicated than I first thought. I'll need to have the form display the data currently in the db, allow the user to add, edit, or delete the data, then display the data on two separate web pages based on motorcycle brand. If this was visual basic on a local computer only, I'd have no problem with it.

The web site I'm working on is www.bmwmotorcyclesofbatonrouge.net. The used motorcycle pages are under motorcycles. I'm looking for sample bits of code and ideas on how to go about accomplishing this task.

Again, thank you for your help.


I don't have control over that. I've taken over the web re-design for the client last year and everything was already set up. I have another site that I created and maintain for our local motorcycle club, and it's hosted at hostmonster.com. I find I have a lot more freedom and access with them then I do with the motorcycle dealership. It's probably costing me less than what they are paying too!!


The bike club pays something like 7 or 8 dollars a month for unlimited everything. Yours seems to be much cheaper.

I'm getting frustrated trying to set up this EasyPHP WAMP I downloaded so that I can test the web pages and MySQL that I am trying to learn. Guess it's time for a break!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.