deansaddigh Posted January 11, 2010 Share Posted January 11, 2010 Basically all i have done is just modified some code and added an area section. The form is allready submitting other things like location price etc. And i have simply added a field in db called area and changes to the page, everything else submits appart from the area. Add properties.php (this has form which gets processed on addimages2.php addProperties.php <?php include('../lib/scripts/php/functions.php'); $page_title='Add Properties'; $page_id_top = 'properties'; $page_id = 'add'; if(isset($_GET['error_code'])) { $error_id = 'Highlighted fields are required'; $highlight = true; } include('../lib/includes/header.php'); $ownerSQL = 'SELECT * FROM owners'; $ownerResults = $db->query($ownerSQL); $property_id =''; $costal =''; $garden =''; $openFire =''; $pets =''; $disabled =''; $groundFloor =''; $shortBreaks =''; $baby =''; $data =''; if (empty($_GET['get_owner'])) { $_GET['get_owner'] = ''; } if (empty($_GET['get_grading'])) { $_GET['get_grading'] = ''; } if (empty($_GET['get_maxGuests'])) { $_GET['get_maxGuests'] = ''; } if (empty($_GET['get_bedrooms'])) { $_GET['get_bedrooms'] = ''; } if (empty($_GET['get_parking'])) { $_GET['get_parking'] = ''; } if (empty($_GET['get_petsAmount'])) { $_GET['get_petsAmount'] = ''; } if (empty($_GET['get_status'])) { $_GET['get_status'] = ''; } if (empty($_GET['get_changeOver'])) { $_GET['get_changeOver'] = ''; } if (empty($_GET['get_linen'])) { $_GET['get_linen'] = ''; } if (empty($_GET['get_special1'])) { $_GET['get_special1'] = ''; } if (empty($_GET['get_special2'])) { $_GET['get_special2'] = ''; } if (empty($_GET['get_access'])) { $_GET['get_access'] = ''; } if (empty($_GET['get_area'])) { $_GET['get_area'] = ''; } if(isset($_GET['id'])) { $property_id = $_GET['id']; $propertiesSQL = "SELECT * FROM properties WHERE id = '$property_id'"; $data = $db->query($propertiesSQL); $_GET['get_owner'] = $data[0]['owner']; $_GET['get_grading'] = $data[0]['grading']; $_GET['get_maxGuests'] = $data[0]['maxGuests']; $_GET['get_bedrooms'] = $data[0]['bedrooms']; $_GET['get_parking'] = $data[0]['parking']; $_GET['get_petsAmount'] = $data[0]['petsAmount']; $_GET['get_status'] = $data[0]['status']; $_GET['get_changeOver'] = $data[0]['changeOver']; $_GET['get_linen'] = $data[0]['linen']; $_GET['get_special1'] = $data[0]['special1']; $_GET['get_special2'] = $data[0]['special2']; $_GET['get_access'] = $data[0]['access']; /*New area*/ $_GET['get_area'] = $data[0]['area']; } if (empty($data)) { if (!empty($_GET['get_owner'])) { $data[0]['owner'] = $_GET['get_owner']; } else { $data[0]['owner'] = ''; } if (!empty($_GET['get_propertyName'])) { $data[0]['propertyName'] = $_GET['get_propertyName']; } else { $data[0]['propertyName'] = ''; } if (!empty($_GET['get_changeOver'])) { $data[0]['changeOver'] = $_GET['get_changeOver']; } else { $data[0]['changeOver'] = ''; } if (!empty($_GET['get_linen'])) { $data[0]['linen'] = $_GET['get_linen']; } else { $data[0]['linen'] = ''; } if (!empty($_GET['get_special1'])) { $data[0]['special1'] = $_GET['get_special1']; } else { $data[0]['special1'] = ''; } if (!empty($_GET['get_special2'])) { $data[0]['special2'] = $_GET['get_special2']; } else { $data[0]['special2'] = ''; } if (!empty($_GET['get_access'])) { $data[0]['access'] = $_GET['get_access']; } else { $data[0]['access'] = ''; } if (!empty($_GET['get_location'])) { $data[0]['location'] = $_GET['get_location']; } else { $data[0]['location'] = ''; } /**********************New**************************/ /*Building in functionality for area search*/ /***************************************************/ if (!empty($_GET['area'])) { $data[0]['area'] = $_GET['get_area']; } else { $data[0]['area'] = ''; } /***********************************************/ if (!empty($_GET['get_grading'])) { $data[0]['grading'] = $_GET['get_grading']; } else { $data[0]['grading'] = ''; } if (!empty($_GET['get_description'])) { $data[0]['description'] = $_GET['get_description']; } else { $data[0]['description'] = ''; } if (!empty($_GET['get_list_description'])) { $data[0]['list_description'] = $_GET['get_list_description']; } else { $data[0]['list_description'] = ''; } if (!empty($_GET['get_maxGuests'])) { $data[0]['maxGuests'] = $_GET['get_maxGuests']; } else { $data[0]['maxGuests'] = ''; } if (!empty($_GET['get_bedrooms'])) { $data[0]['bedrooms'] = $_GET['get_bedrooms']; } else { $data[0]['bedrooms'] = ''; } if (!empty($_GET['get_parking'])) { $data[0]['parking'] = $_GET['get_parking']; } else { $data[0]['parking'] = ''; } if (!empty($_GET['get_petsAmount'])) { $data[0]['petsAmount'] = $_GET['get_petsAmount']; } else { $data[0]['petsAmount'] = ''; } if (!empty($_GET['postcode'])) { $data[0]['postcode'] = $_GET['postcode']; } else { $data[0]['postcode'] = ''; } if (!empty($_GET['get_baby'])) { $data[0]['baby'] = 'checked'; } else { $data[0]['baby'] = ''; } if (!empty($_GET['get_costal'])) { $data[0]['costal'] = 'checked'; } else { $data[0]['costal'] = ''; } if (!empty($_GET['get_garden'])) { $data[0]['garden'] = 'checked'; } else { $data[0]['garden'] = ''; } if (!empty($_GET['get_openFire'])) { $data[0]['openFire'] = 'checked'; } else { $data[0]['openFire'] = ''; } if (!empty($_GET['get_pets'])) { $data[0]['pets'] = 'checked';; } else { $data[0]['pets'] = ''; } if (!empty($_GET['get_disabled'])) { $data[0]['disabled'] = 'checked'; } else { $data[0]['disabled'] = ''; } if (!empty($_GET['get_groundFloor'])) { $data[0]['groundFloor'] = 'checked'; } else { $data[0]['groundFloor'] = ''; } if (!empty($_GET['get_shortBreaks'])) { $data[0]['shortBreaks'] = 'checked'; } else { $data[0]['shortBreaks'] = ''; } if (!empty($_GET['get_status'])) { $data[0]['status'] = 'checked'; } else { $data[0]['status'] = ''; } if (!empty($_GET['get_offline'])) { $data[0]['offline'] = $_GET['offline']; } else { $data[0]['offline'] = ''; } if (!empty($_GET['get_security_fee'])) { $data[0]['security_fee'] = $_GET['get_security_fee']; } else { $data[0]['security_fee'] = ''; } if (!empty($_GET['get_booking_fee'])) { $data[0]['booking_fee'] = $_GET['get_booking_fee']; } else { $data[0]['booking_fee'] = ''; } } ?> <div id="sub_nav"> <? include('subnav2.php');?> </div> <div id="content"> <div id="content_tab"> <!--START OF PAGE TABS--> <? include('add_tabs.php');?> <!--END OF PAGE TABS--> </div> <div id="content_contents"> <!--START OF PAGE CONTENT--> <div class="contentForm"> <form name="addProperties" id="addProperties" method="post" action="properties/addImages.php?id=<?=$property_id?>"> <table border='0' width='700'> <tr> <td width='15%'><? if (!empty($_GET['owner'])){?><font color='red'>Owner:</font><?}else{?>Owner:<?}?></td> <td width='40%'> <select class="list" name="owner" style='width:155px'> <option value ="999" <? if ( $_GET['get_owner'] == '999' ){echo 'selected';}?> >Please Select</option> <? foreach($ownerResults as $ownerResults2) { ?> <option value ="<?=$ownerResults2{'id'}?>" <? if ( $_GET['get_owner'] == $ownerResults2{'id'} ){echo 'selected';}?> ><?=$ownerResults2{'title'}.' '.$ownerResults2{'name'}.' '.$ownerResults2{'surname'}?></option> <? } ?> </select> </td> <td>Status</td> <td> <select name="status" style='width:150px'> <option value ="offline" class="reviewOffline"<? if ( $_GET['get_status'] == 'offline' ){echo 'selected';}?> >Offline</option> <option value ="online" class="reviewOnline"<? if ( $_GET['get_status'] == 'online' ){echo 'selected';}?> >Online</option> </select> </td> </tr> <tr> <td><? if (!empty($_GET['propertyName'])){?><font color='red'>Property Name:</font><?}else{?>Property Name:<?}?></td> <td><input class="inputBox" name="propertyName" type="text" value="<?=$data[0]['propertyName']?>" /></td> <td><? if (!empty($_GET['changeOver'])){?><font color='red'>Change over day:</font><?}else{?>Change over day:<?}?></td> <td> <select class="list" name="changeOver" style='width:150px'> <option value ="" <? if ( $_GET['get_changeOver'] == "" ){echo 'selected';}?> >Please select</option> <option value ="Friday" <? if ( $_GET['get_changeOver'] == "Friday" ){echo 'selected';}?> >Friday</option> <option value ="Saturday" <? if ( $_GET['get_changeOver'] == "Saturday" ){echo 'selected';}?> >Saturday</option> </select> </td> </tr> <tr> <td><? if (!empty($_GET['postcode'])){?><font color='red'>Postcode:</font><?}else{?>Postcode:<?}?></td> <td><input class="inputBox" name="postcode" type="text" value="<?=$data[0]['postcode']?>" /></td> <td></td> <td></td> </tr> <tr> <td><? if (!empty($_GET['location'])){?><font color='red'>Location:</font><?}else{?>Location:<?}?></td> <td><input class="inputBox" name="location" type="text" value="<?=$data[0]['location']?>"/></td> <?php //*********************************// // Drop down box with location values //*********************************//?> <tr> <td><? if (!empty($_GET['area'])){?><font color='red'>Area:</font><?}else{?>Area:<?}?></td> <td> <select class="list" name="area" style='width:150px'> <option value ="South West">South West</option> <option value ="South East" >South East</option> <option value ="London" >London</option> <option value ="East Anglia" >East Anglia</option> <option value ="West Midlands" >West Midlands</option> <option value ="North West" >North West</option> <option value ="Yorkshire and Humberside" >Yorkshire and Humberside</option> <option value ="North East">North East</option> </select> </td> </tr> <? //*************************************************************************************************************************/?> <td><? if (!empty($_GET['grading'])){?><font color='red'>Grading:</font><?}else{?>Grading:<?}?></td> <td> <select class="list" name="grading" style='width:150px'> <option value ="6" <? if ( $_GET['get_grading'] == "6" ){echo 'selected';}?> >No grade</option> <option value ="1" <? if ( $_GET['get_grading'] == '1' ){echo 'selected';}?> >1 stars</option> <option value ="2" <? if ( $_GET['get_grading'] == '2' ){echo 'selected';}?> >2 stars</option> <option value ="3" <? if ( $_GET['get_grading'] == '3' ){echo 'selected';}?> >3 stars</option> <option value ="4" <? if ( $_GET['get_grading'] == '4' ){echo 'selected';}?> >4 stars</option> <option value ="5" <? if ( $_GET['get_grading'] == '5' ){echo 'selected';}?> >5 stars</option> </select> </td> </tr> <tr> <td valign='top'><? if (!empty($_GET['description'])){?><font color='red'>Description:</font><?}else{?>Description:<?}?></td> <td colspan='3'><textarea name='description' cols='63' rows='5'><?=$data[0]['description']?></textarea></td> </tr> <tr> <td valign='top'><? if (!empty($_GET['list_description'])){?><font color='red'>Short Description:</font><?}else{?>Short Description:<?}?></td> <td colspan='3'> <textarea name=list_description wrap=physical cols=63 rows=3 onKeyDown="textCounter(this.form.list_description,this.form.remLen,300);" onKeyUp="textCounter(this.form.list_description,this.form.remLen,150);"><?=$data[0]['list_description']?></textarea> </td> </tr> </table> <BR> <table> <tr> <td width=''><? if (!empty($_GET['maxGuests'])){?><font color='red'>Max guests:</font><?}else{?>Max guests:<?}?></td> <td width='60'> <select class="list" name="maxGuests"> <option value ="" <? if ( $_GET['get_maxGuests'] == '' ){echo 'selected';}?> ></option> <option value ="1" <? if ( $_GET['get_maxGuests'] == '1' ){echo 'selected';}?> >1</option> <option value ="2" <? if ( $_GET['get_maxGuests'] == '2' ){echo 'selected';}?> >2</option> <option value ="3" <? if ( $_GET['get_maxGuests'] == '3' ){echo 'selected';}?> >3</option> <option value ="4" <? if ( $_GET['get_maxGuests'] == '4' ){echo 'selected';}?> >4</option> <option value ="5" <? if ( $_GET['get_maxGuests'] == '5' ){echo 'selected';}?> >5</option> <option value ="6" <? if ( $_GET['get_maxGuests'] == '6' ){echo 'selected';}?> >6</option> <option value ="7" <? if ( $_GET['get_maxGuests'] == '7' ){echo 'selected';}?> >7</option> <option value ="8" <? if ( $_GET['get_maxGuests'] == '8' ){echo 'selected';}?> >8</option> <option value ="9" <? if ( $_GET['get_maxGuests'] == '9' ){echo 'selected';}?> >9</option> <option value ="10" <? if ( $_GET['get_maxGuests'] == '10' ){echo 'selected';}?> >10</option> </select> </td> <td width=''><? if (!empty($_GET['bedrooms'])){?><font color='red'>Bedrooms:</font><?}else{?>Bedrooms:<?}?></td> <td width='60'> <select class="list" name="bedrooms"> <option value ="" <? if ( $_GET['get_bedrooms'] == '' ){echo 'selected';}?> ></option> <option value ="1" <? if ( $_GET['get_bedrooms'] == '1' ){echo 'selected';}?> >1</option> <option value ="2" <? if ( $_GET['get_bedrooms'] == '2' ){echo 'selected';}?> >2</option> <option value ="3" <? if ( $_GET['get_bedrooms'] == '3' ){echo 'selected';}?> >3</option> <option value ="4" <? if ( $_GET['get_bedrooms'] == '4' ){echo 'selected';}?> >4</option> <option value ="5" <? if ( $_GET['get_bedrooms'] == '5' ){echo 'selected';}?> >5</option> <option value ="6" <? if ( $_GET['get_bedrooms'] == '6' ){echo 'selected';}?> >6</option> <option value ="7" <? if ( $_GET['get_bedrooms'] == '7' ){echo 'selected';}?> >7</option> <option value ="8" <? if ( $_GET['get_bedrooms'] == '8' ){echo 'selected';}?> >8</option> <option value ="9" <? if ( $_GET['get_bedrooms'] == '9' ){echo 'selected';}?> >9</option> <option value ="10" <? if ( $_GET['get_bedrooms'] == '10' ){echo 'selected';}?> >10</option> </select> </td> <td>Parking spaces:</td> <td width='100'> <select class="list" name="parking"> <option value ="" <? if ( $_GET['get_parking'] == '' ){echo 'selected';}?> >None</option> <option value ="6" <? if ( $_GET['get_parking'] == '6' ){echo 'selected';}?> >On road</option> <option value ="1" <? if ( $_GET['get_parking'] == '1' ){echo 'selected';}?> >1</option> <option value ="2" <? if ( $_GET['get_parking'] == '2' ){echo 'selected';}?> >2</option> <option value ="3" <? if ( $_GET['get_parking'] == '3' ){echo 'selected';}?> >3</option> <option value ="4" <? if ( $_GET['get_parking'] == '4' ){echo 'selected';}?> >4</option> <option value ="5" <? if ( $_GET['get_parking'] == '5+' ){echo 'selected';}?> >5+</option> </select> </td> <td>Amount of pets:</td> <td> <select class="list" name="petsAmount"> <option value ="0" <? if ( $_GET['get_petsAmount'] == '0' ){echo 'selected';}?> >None</option> <option value ="1" <? if ( $_GET['get_petsAmount'] == '1' ){echo 'selected';}?> >1</option> <option value ="2" <? if ( $_GET['get_petsAmount'] == '2' ){echo 'selected';}?> >2</option> <option value ="3" <? if ( $_GET['get_petsAmount'] == '3' ){echo 'selected';}?> >3</option> <option value ="4" <? if ( $_GET['get_petsAmount'] == '4' ){echo 'selected';}?> >4</option> <option value ="5" <? if ( $_GET['get_petsAmount'] == '5' ){echo 'selected';}?> >5+</option> </select> </td> </tr> </table> <BR><BR> <table> <tr> <td width='80'>Coastal:</td> <td width='50'><input type='checkbox' name='costal' <?=$data[0]['costal']?>></td> <td width='120'>Garden:</td> <td width='50'><input type='checkbox' name='garden'<?=$data[0]['garden']?>></td> <td width='100'>Open fire:</td> <td width='50'><input type='checkbox' name='openFire'<?=$data[0]['openFire']?>></td> <td width='100'>Sleeps baby:</td> <td width='50'><input type='checkbox' name='baby'<?=$data[0]['baby']?>></td> </tr> <tr> <td>Pets:</td> <td><input type='checkbox' name='pets' <?=$data[0]['pets']?>></td> <td>Disabled Access:</td> <td><input type='checkbox' name='disabled' <?=$data[0]['disabled']?>></td> <td>Ground floor access:</td> <td><input type='checkbox' name='groundFloor' <?=$data[0]['groundFloor']?>></td> <td>Short breaks:</td> <td><input type='checkbox' name='shortBreaks' <?=$data[0]['shortBreaks']?>></td> </tr> </table> <BR><BR> <table> <tr> <td>Security fee</td> <td>£<input class="inputBox" size='8' name="security_fee" type="text" value="<?=$data[0]['security_fee']?>" /></td> </tr> <tr> <td>Booking fee</td> <td>£<input class="inputBox" size='8' name="booking_fee" type="text" value="<?=$data[0]['booking_fee']?>" /></td> </tr> <tr> <td width='100'>Linen provision</td> <td> <select class="list" name="linen"> <option value ="none">None</option> <option value ="linen" <? if ( $_GET['get_linen'] == 'linen' ){echo 'selected';}?> >Linen free of charge</option> <option value ="towels" <? if ( $_GET['get_linen'] == 'towels' ){echo 'selected';}?> >Towels free of charge</option> <option value ="both" <? if ( $_GET['get_linen'] == 'both' ){echo 'selected';}?> >Linen and towels free of charge</option> </select> </td> </tr> <tr> <td>Special feature 1</td> <td><input class="inputBox" size='29' name="special1" type="text" value="<?=$data[0]['special1']?>" /></td> </tr> <tr> <td>Special feature 2</td> <td><input class="inputBox" size='29' name="special2" type="text" value="<?=$data[0]['special2']?>" /></td> </tr> <tr> <td valign='top'>Access Statement:</td> <td colspan='3'><textarea name='access' cols='63' rows='5'><?=$data[0]['access']?></textarea></td> </tr> </table> </form> <BR><BR> </div> <img src='images/greyLine.jpg' style='margin-bottom:10px;margin-top:50px;'> <div class="buttonLeft" style='margin-left:680px;'><a href="javascript:document.getElementById('addProperties').submit()">Next</a></div> <!--END OF PAGE CONTENTS--> </div> </div> <?php include('../lib/includes/footer.php'); ?> Addimages2.php <?php include('../lib/scripts/php/functions.php'); $page_title='Add Images'; $page_id_top = 'properties'; $page_id = 'images'; $gm = true; $property_id = $_GET['id']; include('../lib/includes/header.php'); $errors =''; if(!empty($_POST)) { $owner =''; $propertyName =''; $changeOver =''; $location =''; $grading =''; $description =''; $maxGuests =''; $bedrooms =''; $parking =''; $petsAmount =''; $postcode=''; /*area*/ $area= ''; $linen =''; $special1 =''; $special2 =''; $access =''; $costal ='0'; $garden ='0'; $openFire ='0'; $baby ='0'; $pets ='0'; $disabled ='0'; $groundFloor ='0'; $shortBreaks ='0'; $status =''; $owner = $_POST['owner']; $propertyName = $_POST['propertyName']; $changeOver = $_POST['changeOver']; $location = $_POST['location']; /*area*/ $area = $_POST['area']; $grading = $_POST['grading']; $description = $_POST['description']; $description = addslashes($description); $postcode = $_POST['postcode']; $list_description = $_POST['list_description']; $list_description = addslashes($list_description); $maxGuests = $_POST['maxGuests']; $parking = $_POST['parking']; $petsAmount = $_POST['petsAmount']; $linen = $_POST['linen']; $special1 = $_POST['special1']; $special2 = $_POST['special2']; $access = $_POST['access']; $status = $_POST['status']; $bedrooms = $_POST['bedrooms']; if (isset($_POST['costal'])) { $costal = 'checked'; } if (isset($_POST['garden'])) { $garden = 'checked'; } if (isset($_POST['openFire'])) { $openFire = 'checked'; } if (isset($_POST['baby'])) { $baby = 'checked'; } if (isset($_POST['pets'])) { $pets = 'checked'; } if (isset($_POST['disabled'])) { $disabled = 'checked'; } if (isset($_POST['groundFloor'])) { $groundFloor = 'checked'; } if (isset($_POST['shortBreaks'])) { $shortBreaks = 'checked'; } if (empty($owner)) { $errors.= '&owner=1'; } if (empty($propertyName)) { $errors.= '&propertyName=1'; } if (empty($changeOver)) { $errors.= '&changeOver=1'; } if (empty($location)) { $errors.= '&location=1'; } /*area*/ if (empty($area)) { $errors.= '&area=1'; } if (empty($postcode)) { $errors.= '&postcode=1'; } if (empty($grading)) { $errors.= '&grading=1'; } if (empty($description)) { $errors.= '&description=1'; } if (empty($list_description)) { $errors.= '&list_description=1'; } if (empty($maxGuests)) { $errors.= '&maxGuests=1'; } if (empty($bedrooms)) { $errors.= '&bedrooms=1'; } if (!empty($errors)) { $owner = urlencode($owner); $propertyName = urlencode($propertyName); $changeOver = urlencode($changeOver); $location = urlencode($location); $location = urlencode($area); $grading = urlencode($grading); $description = urlencode($description); $maxGuests = urlencode($maxGuests); $bedrooms = urlencode($bedrooms); $parking = urlencode($parking); $petsAmount = urlencode($petsAmount); $linen = urlencode($linen); $special1 = urlencode($special1); $special2 = urlencode($special2); $access = urlencode($access); $postcode = urlencode($postcode); $costal = urlencode($costal); $garden = urlencode($garden); $openFire = urlencode($openFire); $baby = urlencode($baby); $pets = urlencode($pets); $disabled = urlencode($disabled); $groundFloor = urlencode($groundFloor); $shortBreaks = urlencode($shortBreaks); $status = urlencode($status); header('location: addProperties.php?error_code='.$errors.'&get_owner='.$owner.'&postcode='.$postcode.'&get_propertyName='.$propertyName.'&get_changeOver='.$changeOver.'&get_location='.$location.'&get_grading='.$grading.'&get_description='.$description.'&get_list_description='.$list_description.'&get_maxGuests='.$maxGuests.'&get_bedrooms='.$bedrooms.'&get_parking='.$parking.'&get_petsAmount='.$petsAmount.'&get_linen='.$linen.'&get_special1='.$special1.'&get_special2='.$special2.'&get_access='.$access.'&get_costal='.$costal.'&get_garden='.$garden.'&get_openFire='.$openFire.'&get_baby='.$baby.'&get_pets='.$pets.'&get_disabled='.$disabled.'&get_groundFloor='.$groundFloor.'&get_shortBreaks='.$shortBreaks.'&get_status='.$status.'get_area='.$area); die(); } else { if(!empty($_GET['id'])) { //----------------------------------- //UPATE RECORD //----------------------------------- $property_id = $_GET['id']; $updatePropertySQL = "UPDATE properties SET owner = '$owner', propertyName = '$propertyName', changeOver = '$changeOver', location = '$location', grading = '$grading', description = '$description',list_description = '$list_description', maxGuests = '$maxGuests', bedrooms = '$bedrooms', parking='$parking',petsAmount='$petsAmount', costal = '$costal', garden ='$garden',openFire ='$openFire',pets ='$pets',baby ='$baby',disabled ='$disabled',groundFloor ='$groundFloor',shortBreaks ='$shortBreaks',`status` ='$status',linen ='$linen',special1 ='$special1',special2 ='$special2',access='$access', postcode='$postcode', area='$area', WHERE id = $property_id"; $db->execute($updatePropertySQL); echo mysql_error(); $content = " <html> <head> <title>Dorset Cottage Holidays</title> <style type=\"text/css\"> body {font: 11px verdana;} </style> </head> <body> <p>Hi,</p> <p>Someone has updateded the details of $propertyName.</p> <p>Please click the link and double check the details.</p> <p><a href='http://dhcottages.co.uk/details.php?id=$property_id'>Check property</a></p> </body> </html>"; $subject = "Property update on the Dorset Cottage Holiday website"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: [email protected]"; $email = "[email protected]"; //mail($email,$subject,$content,$headers); } else { //----------------------------------- //ADD RECORD //----------------------------------- $addPropertySQL = "INSERT INTO properties(owner,propertyName,changeOver,location,grading,description,list_description,maxGuests,bedrooms,parking,petsAmount,costal,garden,openFire,pets,baby,disabled,groundFloor,shortBreaks,`status`,linen,special1,special2,access, postcode, area) VALUES ('$owner','$propertyName','$changeOver','$location','$grading','$description','$list_description','$maxGuests','$bedrooms','$parking','$petsAmount','$costal','$garden','$openFire','$pets','$baby','$disabled','$groundFloor','$shortBreaks','$status','$linen','$special1','$special2','$access', '$postcode' ,'$area')"; $db->execute($addPropertySQL); echo mysql_error(); $property_id = mysql_insert_id(); $content = " <html> <head> <title>Dorset Cottage Holidays</title> <style type=\"text/css\"> body {font: 11px verdana;} </style> </head> <body> <p>Hi,</p> <p>A new property has been added to the Dorset Cottage Holidays website. ($propertyName)</p> <p>Please click the link and double check the details.</p> <p><a href='http://www.dhcottages.co.uk/details.php?id=$property_id'>Check property</a></p> echo $area; </body> </html>"; $subject = "Property added to the Dorset Cottage Holiday website"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: [email protected]"; $email = "[email protected]"; //mail($email,$subject,$content,$headers); } ?> <!-- generate google map --> <!-- google maps key --> <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAArpssmGkHIk4Pzow_SQH4CxRSTus_UUzkkTlTocJKPLVw2BrG4xR188-et2o7pUA14NwQRxSLXNtQrA" type="text/javascript"></script> <!-- ajax key --> <script src="http://www.google.com/uds/api?file=uds.js&v=1.0&key=ABQIAAAArpssmGkHIk4Pzow_SQH4CxRSTus_UUzkkTlTocJKPLVw2BrG4xR188-et2o7pUA14NwQRxSLXNtQrA" type="text/javascript"></script> <script type="text/javascript"> var map; var localSearch = new GlocalSearch(); function usePointFromPostcode(postcode, callbackFunction) { localSearch.setSearchCompleteCallback(null, function() { if (localSearch.results[0]) { var resultLat = localSearch.results[0].lat; var resultLng = localSearch.results[0].lng; var point = new GLatLng(resultLat,resultLng); $.post('lib/scripts/php/addLongLat.php',{long:resultLng, lat:resultLat, id:<?=$property_id?>}); }else{ alert("Postcode not found!"); } }); localSearch.execute(postcode + ", UK"); } usePointFromPostcode('<?=$postcode?>',''); </script> <? } } ?> <script type="text/javascript"> function ajaxFileUpload() { var nextImage = $("#nextImage").val(); var productId = $("#productId").val(); $("#loading") .ajaxStart(function(){ $(this).show(); }) .ajaxComplete(function(){ $(this).hide(); }); $("#image_"+nextImage).fadeIn(500, function(){ $.ajaxFileUpload ( { url:'lib/scripts/php/upload.php?id='+productId, secureuri:false, fileElementId:'prod_image', dataType: 'json', success: function (data, status) { if(typeof(data.error) != 'undefined') { if(data.error != '') { $("#image_"+nextImage).fadeOut(); }else { $("#image_src_"+nextImage).fadeOut(100,function(){ $("#image_src_"+nextImage).html(unescape(data.msg)); $("#del_"+nextImage).html(unescape(data.del)); $("#label_"+nextImage).html(unescape(data.lbl)); $("#select_"+nextImage).html(unescape(data.type)); $("#image_src_"+nextImage).fadeIn(100); $("#nextImage").val(parseInt(nextImage)+1); }); } } }, error: function (data, status, e) { alert(e); } } ) return false; }); return false; } function removeImage(img_id, prod_id) { $("#images").fadeOut(100, function(){ $("#images").load("lib/scripts/php/imageDiv.php?id="+prod_id+"&img_id="+img_id+"&del", {}, function(){ $("#images").fadeIn(); }); }); return false; } function updatePrimary(img_id,id,val) { $.post("lib/scripts/php/primary.php?id="+img_id+"&prod_id="+id+"&val="+val,{}); } function labelImage(img,id) { var txt = 'Label: <input type="text" id="alertName" name="myname" value="" />'; function mycallbackform(v,m){ if(v == true) { var label = escape(m.children('#alertName').val()); $("#images").fadeOut(100, function(){ $("#images").load("lib/scripts/php/imageDiv.php?id="+id+"&img_id="+img+"&label="+label, {}, function(){ $("#images").fadeIn(); }); }); } } $.prompt(txt,{ callback: mycallbackform, buttons: { Save: true, Cancel: false } }); } </script> <div id="sub_nav"> <? include('subnav2.php');?> </div> <div id="content"> <div id="content_tab"> <!--START OF PAGE TABS--> <? include('add_tabs.php');?> <!--END OF PAGE TABS--> </div> <div id="content_contents"> <!--START OF PAGE CONTENT--> <div id="form_content"> <form name="prodImages" action="<?=$_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data"> <table border="0" width='500'> <tr> <td class="title">Upload new image:</td> <td class="fileElement"> <input type="file" name="prod_image" id="prod_image" /> <input type="hidden" name="productId" id="productId" value="<?=$property_id?>" /> </td> <td> <div class="button" style="float:right"><a href="#" onclick="return ajaxFileUpload();">Upload</a></div> </td> </tr> </table> </form> <div class="divider"></div> Current images: <br /> <div id="images"> <? include('../lib/scripts/php/imageDiv.php'); ?> </div> </div> <!--END OF PAGE CONTENTS--> </div> <img src='images/greyLine.jpg' style='margin-bottom:5px;margin-top:-60px;margin-left:10px;'> <div class="buttonLeft" style='margin-left:690px;margin-top:-50px;'><a href="properties/addPricing.php?id=<?=$property_id?>">Next</a></div> </div> <?php include('../lib/includes/footer.php'); ?> Any help would be amazing as its been puzzling me for ages. Link to comment https://forums.phpfreaks.com/topic/188022-just-cannot-get-area-to-submit-to-db-using-same-php-code-as-already-used/ Share on other sites More sharing options...
r-it Posted January 11, 2010 Share Posted January 11, 2010 firstly, use include_once as opposed to include if (!empty($_GET['area'])) { $data[0]['area'] = $_GET['get_area']; } else { $data[0]['area'] = ''; } should be if (!empty($_GET['get_area'])) { $data[0]['area'] = $_GET['get_area']; } else { $data[0]['area'] = ''; } Link to comment https://forums.phpfreaks.com/topic/188022-just-cannot-get-area-to-submit-to-db-using-same-php-code-as-already-used/#findComment-992746 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.