我已经在顶部定义了函数,但现在出现了这个错误
致命错误:无法在C:\ xampp \ htdocs \ SPdealer \ Admin Panel \中重新声明post()(之前在C:\ xampp \ htdocs \ SPdealer \ Admin Panel \ Property_Insertion_Files \ Customers Online Property_Insert_Page_exe .php:4中声明) Property_Insertion_Files \ Customers Online Property_Insert_Page_exe .php on line 15“
以下是代码:
<?php
$moreaboutgeneralinfo = post('moreaboutgeneralinfo');
function post($moreaboutgeneralinfo, $default = 'N/A')
{
return ( isset($_POST[$moreaboutgeneralinfo]) && !empty($_POST[$moreaboutgeneralinfo]) ) ? $_POST[$moreaboutgeneralinfo] : $default;
}
$infoonboundarywalltype = post('infoonboundarywalltype');
function post($infoonboundarywalltype, $default = 'N/A')
{
return ( isset($_POST[$infoonboundarywalltype]) && !empty($_POST[$infoonboundarywalltype]) ) ? $_POST[$infoonboundarywalltype] : $default;
}
$moreaboutpropertygeneralinformation = post('MoreInfoPropertyGeneralInformation');
function post($moreaboutpropertygeneralinformation, $default = 'N/A')
{
return ( isset($_POST[$moreaboutpropertygeneralinformation]) && !empty($_POST[$moreaboutpropertygeneralinformation]) ) ? $_POST[$moreaboutpropertygeneralinformation] : $default;
}
$infoaboutconsmaterial = post('infoaboutconsmaterial');
function post($infoaboutconsmaterial, $default = 'N/A')
{
return ( isset($_POST[$infoaboutconsmaterial]) && !empty($_POST[$infoaboutconsmaterial]) ) ? $_POST[$infoaboutconsmaterial] : $default;
}
$otherinfoaboutbuildingslabs = post('otherinfoaboutbuildingslabs');
function post($otherinfoaboutbuildingslabs, $default = 'N/A')
{
return ( isset($_POST[$otherinfoaboutbuildingslabs]) && !empty($_POST[$otherinfoaboutbuildingslabs]) ) ? $_POST[$otherinfoaboutbuildingslabs] : $default;
}
$infoaboutfloors = post('infoaboutfloors');
function post($infoaboutfloors, $default = 'N/A')
{
return ( isset($_POST[$infoaboutfloors]) && !empty($_POST[$infoaboutfloors]) ) ? $_POST[$infoaboutfloors] : $default;
}
$infoaboutentrance = post('infoaboutentrance');
function post($infoaboutentrance, $default = 'N/A')
{
return ( isset($_POST[$infoaboutentrance]) && !empty($_POST[$infoaboutentrance]) ) ? $_POST[$infoaboutentrance] : $default;
}
$infoaboutrooms = post('infoaboutrooms');
function post($infoaboutrooms, $default = 'N/A')
{
return ( isset($_POST[$infoaboutrooms]) && !empty($_POST[$infoaboutrooms]) ) ? $_POST[$infoaboutrooms] : $default;
}
$infoaboutbuilding = post('infoaboutbuilding');
function post($infoaboutbuilding, $default = 'N/A')
{
return ( isset($_POST[$infoaboutbuilding]) && !empty($_POST[$infoaboutbuilding]) ) ? $_POST[$infoaboutbuilding] : $default;
}
$infoaboutavailibleitemhome = post('infoaboutavailibleitemhome');
function post($infoaboutavailibleitemhome, $default = 'N/A')
{
return ( isset($_POST[$infoaboutavailibleitemhome]) && !empty($_POST[$infoaboutavailibleitemhome]) ) ? $_POST[$infoaboutavailibleitemhome] : $default;
}
$propertycondition = post('propertycondition');
function post($propertycondition, $default = 'N/A')
{
return ( isset($_POST[$propertycondition]) && !empty($_POST[$propertycondition]) ) ? $_POST[$propertycondition] : $default;
}
$AdditionalInformation = post('AdditionalInformation');
function post($AdditionalInformation, $default = 'N/A')
{
return ( isset($_POST[$AdditionalInformation]) && !empty($_POST[$AdditionalInformation]) ) ? $_POST[$AdditionalInformation] : $default;
}
require('../db.php');
if(!isset($_POST['submit']))
{
echo 'Your Session Is Not Set.';
}
else
{
$ImageID = uniqid();
$emptyresult = array();
$emptyresult['dealername'] = 'Dealer Name';
$emptyresult['dealerfname']='Dealer Father Name';
$emptyresult['dealeroccupation']='Dealer Occupation';
$emptyresult['dealerphone']='Dealer Phone';
$emptyresult['dealeremail']='Dealer Email';
$emptyresult['dealeraddress']='Dealer Address';
$emptyresult['ownername']='Owner Name';
$emptyresult['propertytype']='Property Type';
$emptyresult['PropertyDocumentType']='Property Document Type';
$emptyresult['propertydealtype']='Property Deal Type';
$emptyresult['currencytype']='Currency Type';
$emptyresult['prepostedprice']='Preposted Price';
$emptyresult['priceperarea']='Price Per Area';
$emptyresult['dealstatus']='Deal Status';
$emptyresult['propertystreet']='Property Street';
$emptyresult['propertyregion']='Property Region';
$emptyresult['PropertyArea']='Property Area';
$emptyresult['propertydistanceamount']='Property Distance Amount';
$emptyresult['boundarywall']='Boundary Wall';
$emptyresult['boundraywalltype']='Boundary Wall Type';
$emptyresult['streetroad']='Street Road';
$emptyresult['plot']='Plot';
$emptyresult['constructionmethod']='Construction Method';
$emptyresult['constructionmaterial']='Construction Material';
$emptyresult['buildingslabs']='Building Slabs';
$emptyresult['floors']='Floors';
$emptyresult['buildingentrance']='Building Entrance';
$emptyresult['entrancetype']='Entrance Type';
$emptyresult['numberrooms']='Number of Rooms';
$emptyresult['windowtype']='Windows Type';
$emptyresult['corridors']='Corridors';
$emptyresult['numberandtypekittchen']='Number and Type of Kitchen';
$emptyresult['numberandtypebathroom']='Number and Type of Bathroom';
$emptyresult['itemshome']='Items at Home';
$emptyresult['yard']='Yard';
$emptyresult['yardconstructionmethod']='Yard Construction Method';
$emptyresult['maingatenumber']='Main Gate Number';
$emptyresult['garage']='Garage';
$emptyresult['utilities']='Utilities';
$emptyresult['requirements']='Requirements';
$emptyresult['underconstruction']='Under Construction';
foreach($emptyresult as $key => $val) {
if (empty($_POST[$key])) {
echo "You Have Not Entered Any Value For <b>( $val )</b> <br>";
}
}
$errors = array();
if (empty($_FILES['Upload_Property_Images']['name'][0]))
{
$errors[] = '-You have\'nt Entered Value for upload field';
}
else
{
if (count($_FILES['Upload_Property_Images']['name']) !== 6)
$errors[] = "-Your Only Allowed Six Images";
$whitelist = array("jpg","png","JPG","PNG");
foreach($_FILES['Upload_Property_Images']['name'] as $file)
{
if ($file)
{
$temp = explode('.', $file);
if (!in_array(end($temp), $whitelist ))
{
$errors[] = "-All images must be JPG or PNG<br>";
break;
}
}
}
}
if (!empty($errors))
{
foreach ($errors as $e)
echo $e."<br/>";
exit();
}
if(empty($_POST['drop_1']))
{
echo '-You hav\'nt Select Your Province<br>';
}
if(empty($_POST['drop_2']))
{
echo '-You hav\'nt Select Your District<br>';
}
if(empty($_POST['drop_3']))
{
echo '-You hav\'nt Select Your PD(Nahya)<br><br>';
exit();
}
else
{
$propertydealername = $_POST['dealername'];
$propertydealerfname = $_POST['dealerfname'];
$propertydealeroccupation = $_POST['dealeroccupation'];
$propertydealerphone = $_POST['dealerphone'];
$propertydealeremail = $_POST['dealeremail'];
$propertydealeraddress = $_POST['dealeraddress'];
$propertyownername = $_POST['ownername'];
$propertyownerfname = $_POST['ownerfname'];
$propertyowneroccupation = $_POST['owneroccupation'];
$propertyownerphone = $_POST['ownerphone'];
$propertyowneremail = $_POST['owneremail'];
$propertyowneraddress = $_POST['owneraddress'];
$propertytype = $_POST['propertytype'];
$PropertyDocument= $_POST['PropertyDocumentType'];
$propertydealtype = $_POST['propertydealtype'];
$currencytype = $_POST['currencytype'];
$PrepostedPrice= $_POST['prepostedprice'];
$PricePerArea= $_POST['priceperarea'];
$DealStatus= $_POST['dealstatus'];
$housenumber = $_POST['HouseNumber'];
$propertystreet = $_POST['propertystreet'];
$propertyregion = $_POST['propertyregion'];
$PD = $_POST['drop_3'];
$District = $_POST['drop_2'];
$Province = $_POST['drop_1'];
$PropertyArea = $_POST['PropertyArea'];
$propertyareaamount = $_POST['propertydistanceamount'];
$boundarywall = $_POST['boundarywall'];
$boundraywalltype = join(' - ', $_POST['boundraywalltype']);
$streetroad = join(' - ', $_POST['streetroad']);
$plot = join(' - ', $_POST['plot']);
$constructionmethod = join(' - ', $_POST['constructionmethod']);
$constructionmaterial = join(' - ', $_POST['constructionmaterial']);
$buildingslabs = join(' - ', $_POST['buildingslabs']);
$floors =join(' - ', $_POST['floors']);
$buildingentrance = join(' - ', $_POST['buildingentrance']);
$entrancetype = $_POST['entrancetype'];
$numberrooms = $_POST['numberrooms'];
$windowtype = join(' - ', $_POST['windowtype']);
$corridors = join(' - ', $_POST['corridors']);
$numberandtypekittchen = join(' - ', $_POST['numberandtypekittchen']);
$numberandtypebathroom = join(' - ', $_POST['numberandtypebathroom']);
$itemshome = join(' - ', $_POST['itemshome']);
$yard = join(' - ', $_POST['yard']);
$yardconstructionmethod = join(' - ', $_POST['yardconstructionmethod']);
$maingatenumber = join(' - ', $_POST['maingatenumber']);
$garage = $_POST['garage'];
$utilities = join(' - ', $_POST['utilities']);
$requirements = join(' - ', $_POST['requirements']);
$files=$_FILES['Upload_Property_Images'];
$underconstruction = $_POST['underconstruction'];
$query = "INSERT INTO `properties`
(`PropertyDealerName`,
`PropertyDealerFName`,
`PropertyDealerOccupation`,
`PropertyDealerPhone`,
`PropertyDealerEmail`,
`PropertyDealerAddress`,
`PropertyOwnerName`,
`PropertyOwnerFName`,
`PropertyOwnerOccupation`,
`PropertyOwnerPhone`,
`PropertyOwnerEmail`,
`PropertyOwnerAddress`,
`ImageID`,
`PropertyType`,
`PropertyDocument`,
`PropertyDealType`,
`CurrencyType`,
`PropostedPrice`,
`PricePerArea`,
`DealStatus`,
`MoreinfoDealGeneralInformation`,
`HouseNumber`,
`PropertyStreet`,
`PropertyRegion`,
`PDID`,
`DistrictID`,
`ProvinceID`,
`PropertyArea`,
`PropertyAreaAmount`,
`PropertyBoundaryWall`,
`PropertyBoundaryWallType`,
`MoreInfoOnBoundaryWall`,
`PropertyRoadStreet`,
`PropertyPlot`,
`MoreInfoPropertyGeneralInformation`,
`PropertyConstructionMethod`,
`PropertyConstructionMaterial`,
`MoreInfoOnConstructionMaterial`,
`PropertyBuildingSlabs`,
`MoreInfoOnBuildingSlabs`,
`PropertyFloors`,
`MoreInfoOnPropertyFlooers`,
`PropertyBuildingEntrance`,
`MoreInfoOnPropertyEntrance`,
`PropertyBuildingEntranceType`,
`PropertyRoomNumbers`,
`MoreInfoOnPropertyRooms`,
`PropertyWindowsType`,
`PropertyCorridors`,
`PropertyKitchensNumberType`,
`PropertyBathroomsNumType`,
`PropertyAvailiableItemsRooms`,
`MoreInfobuilding`,
`PropertyYard`,
`PropertyYardConstructionMethod`,
`PropertyMainGateNumber`,
`Garage`,
`MoreInfoYard`,
`PropertyUtilities`,
`PropertyGeneralCondition`,
`PropertyRequirements`,
`AdditionalInformation`,
`UnderConstruction`)
VALUES
('$propertydealername',
'$propertydealerfname',
'$propertydealeroccupation',
'$propertydealerphone',
'$propertydealeremail',
'$propertydealeraddress',
'$propertyownername',
'$propertyownerfname',
'$propertyowneroccupation',
'$propertyownerphone',
'$propertyowneremail',
'$propertyowneraddress',
'$ImageID',
'$propertytype',
'$PropertyDocument',
'$propertydealtype',
'$currencytype',
'$PrepostedPrice',
'$PricePerArea',
'$DealStatus',
'$moreaboutgeneralinfo',
'$housenumber',
'$propertystreet',
'$propertyregion',
'$PD',
'$District',
'$Province',
'$PropertyArea',
'$propertyareaamount',
'$boundarywall',
'$boundraywalltype',
'$infoonboundarywalltype',
'$streetroad',
'$plot',
'$moreaboutpropertygeneralinformation',
'$constructionmethod',
'$constructionmaterial',
'$infoaboutconsmaterial',
'$buildingslabs',
'$otherinfoaboutbuildingslabs',
'$floors',
'$infoaboutfloors',
'$buildingentrance',
'$infoaboutentrance',
'$entrancetype',
'$numberrooms',
'$infoaboutrooms',
'$windowtype',
'$corridors',
'$numberandtypekittchen',
'$numberandtypebathroom',
'$itemshome',
'$infoaboutavailibleitemhome',
'$yard',
'$yardconstructionmethod',
'$maingatenumber',
'$garage',
'$infoaboutbuilding',
'$utilities',
'$propertycondition',
'$requirements',
'$AdditionalInformation',
'$underconstruction');";
$queryrun = $connection->query($query);
if( $connection->error ) exit( $connection->error );
if($queryrun)
{
echo 'The Form With Below Images Has Been Inserted Successfully<br><br>';
}
else
{
echo 'Sorry Query Failed';
}
// start code for the insertion of the images.
if (empty($errors))
{
foreach ($_FILES as $file)
{
mkdir("PropertyImages/$ImageID");
for($x = 0; $x < count($files['name']); $x++)
{
$name=$files['name'][$x];
$tmp_name=$files['tmp_name'][$x];
if(move_uploaded_file($tmp_name, "PropertyImages/$ImageID/".$name))
{
$imagequery="INSERT INTO propertyimages(ImageID, ImageName, ImagePath) VALUES('$ImageID', '$name', 'PropertyImages/$ImageID/$name')";
$imagequeryrun=$connection->query($imagequery);
if( $connection->error ) exit( $connection->error );
echo 'Image <b>'. $name .'</b> Uploaded Successfully <br><br>';
}
}
}
}
}
$subject = 'SPdealers Group';
$message = 'Your Property has been received we are going for verification of your property and during this process we are calling you for further information. Thanks SPdealers Group.';
mail($propertydealeremail,$subject,$message,"From: contact@spdealers.com");
echo "Please Check Your Email Address.";
}
答案 0 :(得分:0)
您在使用后定义了post()
。在脚本的开头定义它,不再出现此错误。
$moreaboutgeneralinfo = post('moreaboutgeneralinfo'); // <-- Used it here
function post($moreaboutgeneralinfo, $default = 'N/A') // <-- Defined here
{
return ( isset($_POST[$moreaboutgeneralinfo]) && !empty($_POST[$moreaboutgeneralinfo]) ) ? $_POST[$moreaboutgeneralinfo] : $default;
}