PHP Code:
<?php
if (isset($_POST['buy_submit2'])) {
$seller_name = $_POST['seller_name'];
$biz_type = $_POST['biz_type'];
$budget = ereg_replace("[^0-9]", "", $_POST['budget']);
$location = $_POST['location'];
$company_name = $_POST['company_name'];
$address = $_POST['address'];
$country = $_POST['country'];
$phone = ereg_replace("[^[:space:]+0-9]", "", $_POST['phone']);
$email = $_POST['email'];
$biz_owner = $_POST['biz_owner'];
$what_type_of_biz = $_POST['what_type_of_biz'];
$reference = $_POST['reference'];
$cash_for_investment = ereg_replace("[^0-9]", "", $_POST['cash_for_investment']);
$time_frame = ereg_replace("[^a-zA-Z0-9]", "", $_POST['time_frame']);
$comment = nl2br($_POST['comment']);
if ($seller_name == '' || $biz_type == '' || $budget == '' || $location == '' || $country == '' || $phone == '' || $email == '' || $biz_owner == '' || $cash_for_investment == '' || $time_frame == '' || $comment == '') {
echo "All fields marked with '*' are required to be filled up.";
echo 'Seller name: '.$seller_name.'<br />';
echo 'Biz type: '.$biz_type.'<br />';
echo 'Budget: '.$budget.'<br />';
echo 'Location: '.$location.'<br />';
echo 'Company Name: '.$company_name.'<br />';
echo 'address: '.$address.'<br />';
echo 'country: '.$country.'<br />';
echo 'phone: '.$phone.'<br />';
echo 'email: '.$email.'<br />';
echo 'Biz owner: '.$biz_owner.'<br />';
echo 'what type of biz: '.$what_type_of_biz.'<br />';
echo 'reference: '.$reference.'<br />';
echo 'cach for investment: '.$cash_for_investment.'<br />';
echo 'time frame: '.$time_frame.'<br />';
echo 'comment: '.$comment.'<br />';
} elseif ($biz_owner == 'yes' && $what_type_of_biz == '') {
echo 'Please fill up the type of your business.';
} elseif ($biz_owner == 'yes' && $reference == '') {
echo 'Please fill up your business reference.';
} elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
echo 'Email is not validate.';
} else {
$query = "INSERT into buy_biz (id, seller_name, biz_type, budget, location, company_name, address, country, phone, email, biz_owner, what_type_of_biz, reference, cash_for_investment, time_frame, comment) VALUES
('', '$seller_name', '$biz_type', '$budget', '$location', '$company_name', '$address', '$country', '$phone', '$email', '$biz_owner', '$what_type_of_biz', '$reference', '$cash_for_investment', '$time_frame', '$comment')";
mysql_query($query) or die("MySQL Error :" . mysql_error());
echo 'Thank you, we will get back to you as soon as possible.';
}
} else {
}
?>
Bookmarks