Create Listing-upload images to dir-display in listing

Hi All

Been desperate to crack this nut for a few years now, but seem to be failing epically!

I have been building a property/real estate web site for a long time, but I have no training and have been learning as I go. I have a script written that allows me to upload data and store it in my database, what I was looking to do was add a section that allows me to upload multiple images at the same time, and store the location to another table in the same database.

So what I was looking to do was remove all the…lets say rubbish to be nice…and see where it takes us.

I apologize in advance for the lack of santized code…I am coding locally only, in an admin area, and will rectify before launching the site…just trying to get the bones of the script in place.

Ok, first we have my form as shown here, warts and all.
[php]<?php
/**

  • Create Listing
    */

?>

CREATE LISTING
		<tr>
			<td align="right"><label class="text">Reception Rooms:&nbsp;</label></td>
			<td>
				<select id="recrooms" name="recrooms">
					<option value="0" selected>Not Selected</option>
					<option value="1">1</option>
					<option value="2">2</option>
					<option value="3">3</option>
					<option value="4">4</option>
					<option value="5">5</option>
					<option value="6">6</option>
					<option value="7">7+</option>
				</select>
			</td>
		</tr>
		<tr>
			<td align="right"><label class="text">Bedrooms:&nbsp;</label></td>
			<td>
				<select id="bedrooms" name="bedrooms">
					<option value="0" selected>Not Selected</option>
					<option value="1">1</option>
					<option value="2">2</option>
					<option value="3">3</option>
					<option value="4">4</option>
					<option value="5">5</option>
					<option value="6">6</option>
					<option value="7">7+</option>
				</select>
			</td>
		</tr>
		<tr>
			<td align="right"><label class="text">Bathrooms:&nbsp;</label></td>
			<td>
				<select id="bathrooms" name="bathrooms">
					<option value="0" selected>Not Selected</option>
					<option value="1">1</option>
					<option value="2">2</option>
					<option value="3">3</option>
					<option value="4">4</option>
					<option value="5">5</option>
					<option value="6">6</option>
					<option value="7">7+</option>
				</select>
			</td>
		</tr>
		<tr>
			<td align="right"><label class="text">Garden:&nbsp;</label></td>
			<td>
				<select id="garden" name="garden">
					<option value="Not Selected" selected>Not Selected</option>
					<option value="Yes">Yes</option>
					<option value="No">No</option>
					<option value="Shared">Shared</option>
				</select>
			</td>
		</tr>
		<tr>
			<td align="right"><label class="text">Garage:&nbsp;</label></td>
			<td>
				<select id="garage" name="garage">
					<option value="Not Selected" selected>Not Selected</option>
					<option value="Yes">Yes</option>
					<option value="No">No</option>
					<option value="Shared">Shared</option>
				</select>
			</td>
		</tr>
		<tr>
			<td align="right"><label class="text">Additional Info:&nbsp;<br />** Not seen by site users **</label></td>
			<td><textarea cols="40" rows="8" type="text" name="addinfo" maxlength="1000" value=""></textarea></td>
		</tr>
		<tr>
			<td align="right"><label class="text">&nbsp;</label></td>
			<td>
				<input type="hidden" name="subcreatelisting" value="1">
				<input type="submit" value="Create Listing">
			</td>
		</tr>
	</table>
</form> 
<?php echo $form->error("creListing"); ?> [/php]

next I have my process page which has the following function included…
[php] function procCreateListing(){

  global $session, $database, $form;
     $q = "INSERT INTO ".TBL_PROP."(prop_id, prop_agent, prop_type, prop_add_1, prop_add_2, prop_town, prop_county, prop_pc, prop_price, prop_price_cond, prop_rec_rooms, prop_bedrooms, prop_bathrooms, prop_status, prop_garden, prop_garage, prop_description_header, prop_description, prop_add_info, prop_add_date) VALUES ('".$_POST['property_title']."', '".$_POST['agent']."', '".$_POST['property_type']."', '".$_POST['address_one']."', '".$_POST['address_two']."', '".$_POST['town']."', '".$_POST['county']."', '".$_POST['postcode']."', '".$_POST['price']."', '".$_POST['price_cond']."', '".$_POST['recrooms']."', '".$_POST['bedrooms']."', '".$_POST['bathrooms']."', '".$_POST['status']."', '".$_POST['garden']."', '".$_POST['garage']."', '".$_POST['deschead']."', '".$_POST['desc']."', '".$_POST['addinfo']."', '".$_POST['date']."')";
     $database->query($q);

}[/php]

and I have 2 tables in mysql

prop_listing and imagebin

[code]CREATE TABLE kea_userclass.prop_listing (
prop_id INT( 10 ) NOT NULL AUTO_INCREMENT ,
prop_agent VARCHAR( 40 ) NOT NULL ,
prop_type VARCHAR( 20 ) NOT NULL ,
prop_add_1 VARCHAR( 50 ) NOT NULL ,
prop_add_2 VARCHAR( 50 ) NOT NULL ,
prop_town VARCHAR( 30 ) NOT NULL ,
prop_county VARCHAR( 25 ) NOT NULL ,
prop_pc VARCHAR( 8 ) NOT NULL ,
prop_price INT( 10 ) NOT NULL ,
prop_price_cond VARCHAR( 20 ) NOT NULL ,
prop_rec_rooms INT( 2 ) NOT NULL ,
prop_bedrooms INT( 3 ) NOT NULL ,
prop_bathrooms INT( 2 ) NOT NULL ,
prop_status VARCHAR( 20 ) NOT NULL ,
prop_garage INT( 1 ) NOT NULL ,
prop_garden INT( 1 ) NOT NULL ,
prop_description_header VARCHAR( 50 ) NOT NULL ,
prop_description VARCHAR( 2000 ) NOT NULL ,
prop_add_info VARCHAR( 2000 ) NOT NULL ,
prop_add_date DATE NOT NULL ,
PRIMARY KEY ( prop_id )
) ENGINE = MYISAM ;

CREATE TABLE imagebin (
id int( 11 ) NOT NULL AUTO_INCREMENT ,
item_id int( 11 ) NOT NULL ,
image varchar( 255 ) NOT NULL ,
PRIMARY KEY ( id ) ) ENGINE = MYISAM DEFAULT CHARSET = latin1;

[/code]

first of all thanks for getting this far, I know it is a lot of reading, and a lot to ask for, but now I am stuck…

[ol][li]I need a section on my form that would allow me to upload 8 images, and store them in a directory folder[/li]
[li]I need the location saved into my imagebin table[/li]
[li]thats it just now[/li][/ol]

Many thanks for reading, and I hope someone can take me under their wing and help me passed this hurdle

Property Title: 
Selling Agent: 
Style:  Not Selected Detached Semi-Detached End Terrace Mid Terrace Flat Ground Floor Flat 4 in a Block Bungalow Apartment Studio Maisonette
Address: 
Address: 
Town: 
County:  Fife
Post Code: 
Price:  Not Selected Offers Over Fixed Price
Property Status:  Not Selected For Sale Sold Subject to Signed Missives Sold Subject to Survey Price Reduced Sold Re-Listed
Description Header: 
Description: 
Sponsor our Newsletter | Privacy Policy | Terms of Service