input to sql not ok with 'copy-paste' - php

i have a php form, that adds a 'review' to a 'guide' in an SQL database.
i finally figured out my problem, and it is when i use copy paste in the input areas.
what can cause this??
any help appreciated!!
this is the link
this is my code:
<body >
<form class="form-horizontal" method="POST" >
<div class="form-group" >
<div class="col-sm-1">
<a href="." > <img src="Pictures/Design/בחזרה לאתר.png" height="100" width="100"/> </a>
</div>
<div class="col-sm-10">
<h2>הוספת ביקורת ל: <?php if(isset($_SESSION ['name'])){echo $_SESSION ['name'];} else {echo $gname;}?></label>
</h2>
</div>
</div>
<hr>
<div class="form-group">
<div class="col-sm-12 " >
<div class="col-sm-4 " align="right">
<?php $val="uploads/guides/".$row['Picture'];?>
<image src='<?php echo $val;?>' height="130px" width="100px">
</div>
<div class="col-sm-7 " align="right">
<div><label class=" control-label" ><?php if(isset($_SESSION ['name'])){echo $_SESSION ['name'];} else {echo $gname;}?></label><label class=" control-label" >&nbsp&nbsp&nbsp:שם המדריך</label></div>
<div><label class=" control-label" ><?php if(isset($_SESSION ['attraction'])){echo $_SESSION ['attraction'];} else {echo $gattraction;}?></label><label class=" control-label" >&nbsp&nbsp&nbsp:אטרקציה</label></div>
<div><label class=" control-label" ><?php if(isset($_SESSION ['email'])){echo $_SESSION ['email'];} else {echo $gemail;}?></label><label class=" control-label" >&nbsp&nbsp&nbsp:אימייל</label></div>
<div><label class=" control-label" ><?php if(isset($_SESSION ['phone'])){echo $_SESSION ['phone'];} else {echo $gphone;}?></label><label class=" control-label" >&nbsp&nbsp&nbsp:טלפון</label></div>
</div>
</div>
</div>
<hr>
<div class="form-group">
<div class="col-sm-12 " >
<div class="col-sm-6 col-sm-offset-6" align="right">
<label class=" control-label" >שמך המלא</label>
</div>
<div class="col-sm-12">
<input type="text" class="form-control" name="name" placeholder="" />
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-12 " >
<div class="col-sm-6 col-sm-offset-6" align="right">
<label class=" control-label" >מתי השתמשת בשירותי המדריך</label>
</div>
<div class="col-sm-6 " align="right">
<select class="form-control" name="year">
<option value="בחר/י שנה">בחר/י שנה</option>
<option value="2016">2016</option>
<option value="2015">2015</option>
<option value="2014">2014</option>
<option value="2013">2013</option>
<option value="2012">2012</option>
<option value="2011">2011</option>
<option value="2010">2010</option>
<option value="2009">2009</option>
</select>
</div>
<div class="col-sm-6 " align="right">
<select class="form-control" name="month">
<option value="בחר/י חודש">בחר/י חודש</option>
<option value="ינואר">ינואר</option>
<option value="פברואר">פברואר</option>
<option value="מרץ">מרץ</option>
<option value="אפריל">אפריל</option>
<option value="מאי">מאי</option>
<option value="יוני">יוני</option>
<option value="יולי">יולי</option>
<option value="אוגוסט">אוגוסט</option>
<option value="ספטמבר">ספטמבר</option>
<option value="אוקטובר">אוקטובר</option>
<option value="נובמבר">נובמבר</option>
<option value="דצמבר">דצמבר</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-12 " >
<div class="col-sm-6 col-sm-offset-6" align="right">
<label class=" control-label" >ציון 1-5</label>
</div>
<div class="col-sm-3 col-sm-offset-9 " align="right">
<select class="form-control " name="rating">
<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>
</select>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-12 " >
<div class="col-sm-6 col-sm-offset-6" align="right">
<label class=" control-label" >כמה שילמת ומה זה כלל</label>
</div>
<div class="col-sm-12">
<textarea class="form-control" name="pay" cols="40" rows="2"></textarea>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-12 " >
<div class="col-sm-6 col-sm-offset-6" align="right">
<label class=" control-label" >פרטו את חוויתכם עם המדריך בהרחבה</label>
</div>
<div class="col-sm-12">
<textarea class="form-control" name="exp" cols="40" rows="5" required></textarea>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-12 " >
</div>
</div>
<div class="form-group" >
<div class="col-sm-12 col-sm-offset-5"><button type="submit" class="btn btn-primary btn-sm" name="addreview" value="Submit Record">הוספת ביקורת</button></div>
</div>
<?php
if(isset($_POST['addreview'])){
$name = $_POST['name'];
$name = str_replace("'","''",$name);
$monthh = $_POST['month'];
$yearr = $_POST['year'];
$pay = $_POST['pay'];
$pay = str_replace("'","''",$pay);
$exp= $_POST['exp'];
$exp = str_replace("'","''",$exp);
$rating=$_POST['rating'];
$query1="INSERT INTO review (ReviewerName,ServiceMonth,ServiceYear,Rating,Payment,Experience,Guide_ID) VALUES ";
$query1.="('$name','$monthh','$yearr','$rating','$pay','$exp','$guideid')";
$result=mysqli_query($conn,$query1);
if($result){
?>
<script type="text/javascript">
window.location = "./review_added_successfully.php";
</script>
<?php
}
else{
echo "not submitted";
}
} ?>
</form>
</body>

Related

Cubic calculation SESSION PHP

I am trying to do a cubic calculator program where the calculated cubic meter is always added to the result of the previous calculation and displayed. I'm trying to do it with SESSION but it doesn't work out. When I start the calculation it does not show the value. How can I store the previous calculation and add it to the new one?
<?php
session_start();
include 'settings.php';
$title = 'Főoldal';
require_once 'components/htmltop.php';
require_once 'components/navbar.php';
if(isset($_POST["add_to_cart"]))
{
if(isset($_SESSION["cubic_cart"]))
{
$item_array = array(
'item_width' => $_POST["width"],
'item_length' => $_POST["length"],
'item_thickness' => $_POST["thickness"]
);
$_SESSION["cubic_cart"][0] = $item_array;
}
}
?>
<div class="col container text-center">
<div class="row">
<div class="col-sm">
<div class="container">
<form action="" method="post" class="col mx-auto mb-2 form-group p-3 text-center">
<div class="form-group col-md">
<input id="textBar" type="text" name="width" value="" class="i1 form-control mb-3 mx-auto" autocomplete="off" required>
</div>
<div class="row">
<div class="form-group col-md-6">
<select type="text" name="length" value="" class="s2 form-control mb-3 mx-auto" required>
<option selected>Length</option>
<option value="2.5">2.5</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</div>
<div class="form-group col-md-6">
<select type="text" name="thickness" value="" class="s2 form-control mb-3 mx-auto" required>
<option selected>Thickness</option>
<option value="0.029">29</option>
<option value="0.031">31</option>
</select>
</div>
</div>
<button type="submit" name="add_to_cart" class="btn btn-lg btn-success" onclick="return confirm('Biztos rögzíteni szeretné?')">Calculate</button>
</form>
</div>
<div id="clockDisplay" class="container mb-2"></div>
<div claas="container">
<div class="row">
<div class="napi col-md-6 mt-3">
<?php
if(!empty($_SESSION["cubic_cart"]))
{
$total = 0;
foreach($_SESSION["cubic_cart"] as $keys => $values)
{
?>
<?php
$total = $total + ($values["item_width"] * $values["item_length"]* $values["item_thickness"]);
}
?>
?>
<h3>Total: </h3>
<h2><?php echo number_format($total, 4); ?> m3</h2>
<?php
}
?>
</div>
</div>
</div>

How to fix "Notice: Undefined index: message in" [duplicate]

This question already has answers here:
"Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP
(29 answers)
Closed 3 years ago.
I am new to PHP and trying to make a form which will email me. However, I am getting an error when submitting it.
I have pasted the form HTML and PHP for it below, any help I can get is appreciated.
<form style="text-align: center; border: 1px solid black;" action="" method="post" id="form">
<div class="row spacing-top">
<div class="col-md-4">
<div>
<label id="title_text">TITLE</label>
</div>
</div>
<div class="col-md-8">
<div>
<select id="title" name="title" style="margin-top: 5px;">
<option value="">Please select</option>
<option value="Mr">Mr</option>
<option value="Mr">Mrs</option>
<option value="Mr">Mx</option>
<option value="Mr">Ms</option>
<option value="Mr">Miss</option>
<option value="Mr">Dr</option>
</select>
</div>
</div>
</div>
<div class="row spacing-top">
<div class="col-md-4">
<div>
<label id="name_text" style="margin-top: 3px;">First Name *</label>
</div>
</div>
<div class="col-md-8">
<div>
<input type="text" id="first_name" name="first_name" style="margin-top: 5px;" required>
</div>
</div>
</div>
<div class="row spacing-top">
<div class="col-md-4">
<div>
<label id="last_text" style="margin-top: 3px;">Last Name *</label>
</div>
</div>
<div class="col-md-8">
<div>
<input type="text" id="last_name" name="last_name" style="margin-top: 5px;" required>
</div>
</div>
</div>
<div class="row spacing-top">
<div class="col-md-4">
<div>
<label id="dept_text" style="margin-top: 3px;">Department *</label>
</div>
</div>
<div class="col-md-8">
<div>
<select id="dept" name="dept" style="margin-top: 5px;">
<option value="">Please select</option>
<option value="Mr">Mr</option>
<option value="Mr">Mrs</option>
<option value="Mr">Mx</option>
<option value="Mr">Ms</option>
<option value="Mr">Miss</option>
<option value="Mr">Dr</option>
</select>
</div>
</div>
</div>
<div class="row spacing-top">
<div class="col-md-4">
<div>
<label id="job" style="margin-top: 3px;">Job Title *</label>
</div>
</div>
<div class="col-md-8">
<div>
<input type="text" id="job" name="job" style="margin-top: 5px;" required>
</div>
</div>
</div>
<div class="row spacing-top">
<div class="col-md-4">
<div>
<label id="start" style="margin-top: 3px;">Start Date *</label>
</div>
</div>
<div class="col-md-8">
<div>
<input type="date" id="start" name="start" style="margin-top: 5px;" required>
</div>
</div>
</div>
<div class="row spacing-top">
<div class="col-md-4">
<div>
<label id="manager" style="margin-top: 3px;">Manager *</label>
</div>
</div>
<div class="col-md-8">
<select id="manager" name="manager" style="margin-top: 5px;" required>
<option value="">Please select</option>
<option value="Mr">Mr</option>
<option value="Mr">Mrs</option>
<option value="Mr">Mx</option>
<option value="Mr">Ms</option>
<option value="Mr">Miss</option>
<option value="Mr">Dr</option>
</select>
</div>
</div>
<div class="row spacing-top">
<div class="col-md-4">
<div>
<label id="location" style="margin-top: 3px;">Location *</label>
</div>
</div>
<div class="col-md-8">
<select id="location" name="location" style="margin-top: 5px;" required>
<option value="">Please select</option>
<option value="Mr">Mr</option>
<option value="Mr">Mrs</option>
<option value="Mr">Mx</option>
<option value="Mr">Ms</option>
<option value="Mr">Miss</option>
<option value="Mr">Dr</option>
</select>
</div>
</div>
<div class="row spacing-top">
<div class="col-md-4">
<div>
<label id="nwc" style="margin-top: 3px;">Now We Comply *</label>
</div>
</div>
<div class="col-md-8">
<select id="nwc" name="nwc" style="margin-top: 5px;" required>
<option value="">Please select</option>
<option value="Mr">Mr</option>
<option value="Mr">Mrs</option>
</select>
</div>
</div>
<div class="row spacing-top">
<div class="col-md-4">
<div>
<label id="vdq" style="margin-top: 3px;">VQD? Which instance? *</label>
</div>
</div>
<div class="col-md-8">
<div>
<input type="text" id="vdq" name="vdq" style="margin-top: 8px;" required>
</div>
</div>
</div>
<div class="row spacing-top">
<div class="col-md-4">
<div>
<label id="phone" style="margin-top: 3px;">Phone Extention *</label>
</div>
</div>
<div class="col-md-8">
<select id="phone" name="phone" style="margin-top: 5px;" required>
<option value="">Please select</option>
<option value="Mr">Yes</option>
<option value="Mr">No</option>
</select>
</div>
</div>
<div class="row spacing-top">
<div class="col-md-4">
<div>
<label id="hardware" style="margin-top: 3px;">IT Hardware *</label> //come back to this
</div>
</div>
<div class="col-md-8">
<div class="checkbox">
<label><input type="checkbox" if="keyboard" value="keyboard">Keyboard</label>
</div>
<div class="checkbox">
<label><input type="checkbox" id="mouse" value="mouse">Mouse</label>
</div>
<div class="checkbox disabled">
<label><input type="checkbox" id="laptop" value="laptop">Laptop</label>
</div>
<div class="checkbox disabled">
<label><input type="checkbox" id="desktop" value="desktop">Desktop</label>
</div>
<div class="checkbox disabled">
<label><input type="checkbox" id="monitor" value="monitor">Monitor</label>
</div>
<div class="checkbox disabled">
<label><input type="checkbox" id="docking_station" value="docking_station">Docking Station</label>
</div>
<div class="checkbox disabled">
<label><input type="checkbox" id="case" value="case">Laptop Case</label>
</div>
</div>
</div>
<div class="row spacing-top">
<div class="col-md-4">
<div>
<label id="login" style="margin-top: 3px;">AD log in *</label>
</div>
</div>
<div class="col-md-8">
<div>
<input type="text" id="login" name="login" style="margin-top: 5px;" required>
</div>
</div>
</div>
<div class="row spacing-top">
<div class="col-md-4">
<div>
<label id="password" style="margin-top: 3px;">Password *</label>
</div>
</div>
<div class="col-md-8">
<div>
<input type="password" id="password" name="password" style="margin-top: 5px;" required>
</div>
</div>
</div>
<div class="row spacing-top">
<div class="col-md-4">
<div>
<label id="email" style="margin-top: 3px;">Email Address(es) *</label>
</div>
</div>
<div class="col-md-8">
<div>
<input type="text" id="email" name="email" style="margin-top: 5px;" required>
</div>
</div>
</div>
<div class="row spacing-top">
<div class="col-md-4">
<div>
<label id="disgroup" style="margin-top: 3px;">Distribution Groups *</label>
</div>
</div>
<div class="col-md-8">
<div>
<input type="text" id="disgroup" name="disgroup" style="margin-top: 5px;" required>
</div>
</div>
</div>
<div class="row spacing-top">
<div class="col-md-4">
<div>
<label id="access" style="margin-top: 3px;">Drive & Folder Access *</label>
</div>
</div>
<div class="col-md-8">
<div>
<input type="text" id="access" name="access" style="margin-top: 5px;" required>
</div>
</div>
</div>
<input type="submit" name="submit" value="Submit">
</form>
</div>
</div>
</body>
</html>
<?php
if(isset($_POST['submit'])){
$to = "MY EMAIL"; // this is your Email address
$from = "ANOTHER EMAIL"; // this is the sender's Email address
$title = $_POST['title'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$dept = $_POST['dept'];
$job = $_POST['job'];
$start = $_POST['start'];
$manager = $_POST['manager'];
$location = $_POST['location'];
$nwc = $_POST['nwc'];
$vdq = $_POST['vdq'];
$phone = $_POST['phone'];
$login = $_POST['login'];
$password = $_POST['password'];
$email = $_POST['email'];
$disgroup = $_POST['disgroup'];
$access = $_POST['access'];
$subject = "New Starter";
$message = "Here is the new starter details" . "\n\n" . $title . "\n" . $first_name . "\n" .
$last_name . "\n" . $dept . "\n" . $job . "\n" . $start . "\n" . $manager . "\n" .
$location . "\n" . $nwc . "\n" . $vdq . "\n" . $phone. $_POST['message'];
$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message,$headers);
echo "Mail Sent. Thank you " . $first_name . ", we will contact you shortly.";
}
?>
This is the error I am getting when I click submit "Notice: Undefined index: message in /storage/ssd1/948/10446948/public_html/index.php on line 355"
There is no value/missing for $_POST['message']. You may need to insert in your html in order to get them. Thats why it is issuing you with an undefined index.
<input type="textarea" name="message">
in your php code:
$user_message = $_POST['message'];
in your last line of $message put .$user_message
Hope this helps and if your mail function does not work, you may need a mail server configuration to enable the send email function in your php code. All the best and happy coding!

How to get an array from form data

I am using Metronic Form Repeater in our project.
My form tag doesn't have any encryption or content type.
<form class="m-form" action="<?php echo $action; ?>" method='POST'></form>
When I submit the form, I can see our data like below
Unfortunately, when I print the $_POST, I see an empty array.
Form Code
<div class="form-group m-form__group row" id="m_repeater_1">
<div data-repeater-list="" class="col-lg-12">
<div data-repeater-item class="form-group m-form__group row align-items-center">
<div class="col-md-3">
<div class="m-form__group m-form__group--inline">
<div class="m-form__label">
<label>Column Name</label>
</div>
<div class="m-form__control">
<input type="name" name="col_name" class="form-control m-input" placeholder="Enter full name">
</div>
</div>
<div class="d-md-none m--margin-bottom-10"></div>
</div>
<div class="col-md-4">
<div class="m-form__group m-form__group--inline">
<div class="form-group m-form__group row">
<label class="col-form-label col-lg-3 col-sm-12">Data Type</label>
<div class="col-lg-6 col-md-9 col-sm-6">
<select class="form-control m-select2" id="m_select2_1" name="param">
<option value='TINYINT'>TINYINT</option>
<option value='SMALLINT'>SMALLINT</option>
<option value='MEDIUMINT'>MEDIUMINT</option>
</select>
</div>
</div>
</div>
<div class="d-md-none m--margin-bottom-10"></div>
</div>
<div class="col-md-3">
<div class="m-form__group m-form__group--inline">
<div class="m-form__label">
<label>Length</label>
</div>
<div class="m-form__control">
<input type="number" name="col_long" class="form-control m-input" placeholder="Uzunluk Giriniz">
</div>
</div>
<div class="d-md-none m--margin-bottom-10"></div>
</div>
<div class="form-group m-form__group col-md-3">
<label for="exampleSelect1">Default</label>
<select class="form-control m-input" id="exampleSelect1" name="col_def">
<option value='1'>NoDefault</option>
<option value='2'>NULL</option>
<option value='3'>CURRENT_TIMESTAMP</option>
<option value='4'>ON UPDATE CURRENT_TIMESTAMP</option>
<option value='5'>AUTO_INCREMENT</option>
</select>
</div>
</div>
</div>
</div>

Insert Data to database not working

i have this html form
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">Please Input Below Information</h3>
</div>
<!-- /.box-header -->
<!-- form start -->
<form method="POST" action="model.php" class="form-horizontal">
<div class="box-body">
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Model Code *</label>
<div class="col-sm-10">
<input type="text" name="ModelCode" class="form-control" id="inputEmail3" placeholder="e.g KTI">
</div>
</div>
<div class="form-group">
<label for="inputPassword3" class="col-sm-2 control-label">Model Name *</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="ModelName" id="inputPassword3" placeholder="e.g 0002">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Model Units *</label>
<div class="col-sm-10">
<select class="form-control" name="ModelUnit" style="width: 100%;">
<option value="" selected disabled>Choose Model Unit</option>
<?php
$sql = mysqli_query($con, "select departmentname from department");
while ($row = mysqli_fetch_array($sql)) {
?>
<option value="<?php echo $row['departmentname']; ?>"><?php echo $row['departmentname']; ?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Model Hour Theroy *</label>
<div class="col-sm-10">
<select class="form-control" name="ModelHourT" style="width: 100%;">
<option value="" selected disabled>Choose Model Hour</option>
<?php
$sql = mysqli_query($con, "select GroupTeory from grouptheory");
while ($row = mysqli_fetch_array($sql)) {
?>
<option value="<?php echo $row['GroupTeory']; ?>"><?php echo $row['GroupTeory']; ?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Model Hour Practice *</label>
<div class="col-sm-10">
<select class="form-control" name="ModelHourP" style="width: 100%;">
<option value="" selected disabled>Choose Model Practice</option>
<?php
$sql = mysqli_query($con, "select GroupPractical from grouppractical");
while ($row = mysqli_fetch_array($sql)) {
?>
<option value="<?php echo $row['GroupPractical']; ?>"><?php echo $row['GroupPractical']; ?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Model Type *</label>
<div class="col-sm-10">
<input type="text" name="ModelType" class="form-control" id="inputEmail3" placeholder="e.g KTI">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Semister *</label>
<div class="col-sm-10">
<select class="form-control" style="width: 100%;" name="SemsterID">
<option value="" selected disabled>Choose Model Type</option>
<?php
$sql = mysqli_query($con, "select Semester from semester");
while ($row = mysqli_fetch_array($sql)) {
?>
<option value="<?php echo $row['Semester']; ?>"><?php echo $row['Semester']; ?></option>
<?php
}
?>
</select>
</div>
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
<input type="submit" name="submit" class="btn btn-info pull-right" value="Submit" />
</div>
<!-- /.box-footer -->
</form>
</div>
and this is my php insert function
include("Connection.php");
if(isset($_POST['submit']))
{
echo "<script>alert($query1)</script>";
$ModelCode = mysqli_real_escape_string($con,$_POST['ModelCode']);
$ModelName = mysqli_real_escape_string($con,$_POST['ModelName']);
$ModelUnit = mysqli_real_escape_string($con,$_POST['ModelUnit']);
$ModelHourT =mysqli_real_escape_string($con,$_POST['ModelHourT']);
$ModelHourP = mysqli_real_escape_string($con,$_POST['ModelHourP']);
$ModelType = mysqli_real_escape_string($con,$_POST['ModelType']);
$SemsterID = mysqli_real_escape_string($con,$_POST['SemsterID']);
$query1 = mysqli_query($con, "INSERT INTO 'model' (ModelCode,ModelName,ModelUnit,ModelHourTheory,ModelHourPractical,ModelType,StageID) VALUES ('$ModelCode','$ModelName','$ModelUnit','$ModelHourT','$ModelHourP','$ModelType' ,'$SemsterID')");
echo "<script>alert($query1)</script>";
}
and it doesn't work .... i didn't no what's happen !! even i have been compare fields of the table with the name of the database ... but it still doesn't work ... anyone knows what is problem ?
You don't should use single quote for table name (in this case single quote is for literal value )
Assuming that you table is named model you should use
$query1 = mysqli_query($con,
"INSERT INTO model (ModelCode, ModelName,ModelUnit,
ModelHourTheory,ModelHourPractical,ModelType,StageID)
VALUES ('$ModelCode','$ModelName','$ModelUnit',
'$ModelHourT','$ModelHourP','$ModelType','$SemsterID')");

how to create multiple query in one. when i want fetch date from database which is search from user

here my html code.
i want fetch data from database. when a user search profile then i want display only searched data which enter in form.
the problem is query doesn't work. can you tell me can we run multiple query in single query.
<form method="get" action="search.php" enctype="multipart/form-data">
<div class="form_but1">
<label class="col-sm-2 control-lable1" for="sex">Gender : </label>
<div class="col-sm-7 form_radios">
<div class="select-block1">
<select name="gender">
<option value="">Select Gender</option>
<option value="">Male</option>
<option value="">Female</option>
</select>
</div>
</div>
<div class="clearfix"> </div>
</div>
<div class="form_but1">
<label class="col-sm-2 control-lable1" for="sex">Marital Status : </label>
<div class="col-sm-7 form_radios">
<div class="select-block1">
<select name="mstatus">
<option>Select status</option>
<option value="Single">Single</option>
<option value="Married">Married</option>
<option value="Widow">Widow</option>
<option value="Widower">Widower</option>
<option value="Divorcee">Divorcee</option>
<option value="Seprated">Seprated</option>
</select>
</div>
</div>
<div class="clearfix"> </div>
</div>
<div class="form_but1">
<label class="col-sm-2 control-lable1" for="sex">Gotra : </label>
<div class="col-sm-7 form_radios">
<div class="select-block1">
<select name="gotra">
<option>Select gotra</option>
<option value="Aalakuntor">Aalakuntor</option>
<option value="Bantalor">Bantalor</option>
<option value="Batalor">Batalor</option>
<option value="Bayamuttalor">Bayamuttalor</option>
</select>
</div>
</div>
<div class="clearfix"> </div>
</div>
<div class="form_but1">
<label class="col-sm-2 control-lable1" for="sex">District / City : </label>
<div class="col-sm-7 form_radios">
<div class="select-block1">
<input type="text" class="form-control" placeholder="city" name="city" >
</div>
</div>
<div class="clearfix"> </div>
</div>
<div class="form_but1">
<label class="col-sm-2 control-lable1" for="sex">Education : </label>
<div class="col-sm-7 form_radios">
<div class="select-block1">
<input type="text" class="form-control" placeholder="education" name="education" >
</div>
</div>
<div class="clearfix"> </div>
</div>
<div class="form_but1">
<label class="col-sm-2 control-lable1" for="sex">Age : </label>
<div class="col-sm-7 form_radios">
<div class="col-sm-5 input-group1">
<input class="form-control has-dark-background" name="age1" id="slider-name" placeholder="28" type="text" >
</div>
<div class="col-sm-5 input-group1">
<input class="form-control has-dark-background" name="age2" id="slider-name" placeholder="40" type="text" >
</div>
<div class="clearfix"> </div>
</div>
<div class="clearfix"> </div>
</div>
<div class="form_but1">
<div class="col-sm-5 input-group1">
<div class="select-block1">
<input type="submit" class="btn btn-success" value="Search" name="search">
</div>
</div>
<div class="clearfix"> </div>
</div>
</form>
here my search.php code.
<div class="paid_people">
<h1></h1>
<div class="row_1">
<?php
include("includes/db.php");
global $con;
if(isset($_GET['search']))
{
$search_gender = $_GET['gender'];
$search_mstatus = $_GET['mstatus'];
$search_gotra = $_GET['gotra'];
$search_city = $_GET['city'];
$search_education = $_GET['education'];
$search_age1 = $_GET['age1'];
$search_age2 = $_GET['age2'];
$get_user = "SELECT * FROM users WHERE age BETWEEN '$search_age1' AND '$search_age2' AND gender like '$search_gender' AND mstatus like '$search_mstatus' AND gotra like '$search_gotra' AND education like '$search_education' AND city like'$search_city'";
$run_user = mysqli_query($con, $get_user);
while ($row_user = mysqli_fetch_array($run_user))
{
$u_id = $row_user['user_id'];
$u_fname = $row_user['first_name'];
$u_age = $row_user['age'];
$u_education = $row_user['education'];
$u_occupation = $row_user['occupation'];
$u_city = $row_user['city'];
$u_image = $row_user['photo'];
$profile_id = $row_user['profile_id'];
echo "<div class='col-sm-6 paid_people-left'>
<ul class='profile_item'>
<a href='view_profile.php?userdetail_id=$u_id'>
<li class='profile_item-img'>
<img src='admin_vadarshadi/users-photo/resized_$u_image' class='img-responsive' alt='$u_fname' />
</li>
<li class='profile_item-desc'>
<h4>Profile ID: $profile_id</h4>
<h4>Name: $u_fname Age: $u_age Yrs </h4>
<p>City: $u_city, Education: $u_education</p>
<h5>View Full Profile</h5>
</li>
<div class='clearfix'> </div>
</a>
</ul>
</div>";
}
}
?>
</div>
</div>

Categories