data is not submitted to database using php mysql - php

I am using php and MySQL. When I submit the form data is not stored in the database table 'plantation_journal_nursery_details'. I am badly stuck here. Can anyone please advice me that how can I solve this problem?? Thanks in advance guys. codes are given below :
create_journal.php
<form action="data_fetch.php" action="post">
<div class="row">
<div class="col-sm-4">
<h4 style="font-size: 16px;padding-left: 15px;"><b>Nursery Location:</b></h4><br>
<div align="right" style="padding-right: 10px;">
<label style="font-weight:300;font-size: 15px">Location:</label>
<input type="text" name="location" id="location" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
<label style="font-weight:300;font-size: 15px">Area:</label>
<input type="text" name="area1" id="area1" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
<label style="font-weight:300;font-size: 15px">type of Nursey:</label>
<select name="type_of_nursery" id="type_of_nursery" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select><br><br>
<label style="font-weight:300;font-size: 15px">Centranl Nursery Name:</label>
<select name="central_nursery_name" id="central_nursery_name" style="width:40%;height: 30px; margin-left: 10px; border-radius: 5px;">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select><br><br>
<label style="font-weight:300;font-size: 15px">State Nursery Name:</label>
<input type="text" name="state_nursery_name" id="state_nursery_name" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
</div>
</div>
<div class="col-sm-4">
<h4 style="font-size: 16px;padding-left: 15px;"><b>Size of Each Bed:</b></h4><br>
<div align="right" style="padding-right: 10px;">
<label style="font-weight:300;font-size: 15px">Mother Bed Size:</label>
<input type="text" name="mother_bed_size" id="mother_bed_size" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
<label style="font-weight:300;font-size: 15px">Quantity:</label>
<input type="text" name="quantity_m" id="quantity_m" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br><br><br>
<label style="font-weight:300;font-size: 15px">Source of Seed:</label>
<select name="source_of_seed" id="source_of_seed" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select><br><br>
</div>
</div>
<div class="col-sm-4">
<div align="right" style="padding-right: 10px; padding-top: 40px">
<label style="font-weight:300;font-size: 15px">Polypot Bed Size:</label>
<input type="text" name="polypot_bed_size" id="polypot_bed_size" style="width:42%;height: 30px; margin-left: 4px; border-radius: 5px;"><br>
<label style="font-weight:300;font-size: 15px">Quantity:</label>
<input type="text" name="quantity_p" id="quantity_p" style="width:42%;height: 30px; margin-left: 4px; border-radius: 5px;"><br><br>
<label style="font-weight:300;font-size: 15px">Hycopot Bed Size:</label>
<input type="text" name="hycopot_bed_size" id="hycopot_bed_size" style="width:42%;height: 30px; margin-left: 4px; border-radius: 5px;"><br>
<label style="font-weight:300;font-size: 15px">Quantity:</label>
<input type="text" name="quantity_h" id="quantity_h" style="width:42%;height: 30px; margin-left: 4px; border-radius: 5px;"><br>
</div>
</div>
</div>
<div class="row">
<div align="right" style="padding-right: 10px;">
<input class="btn btn-info" type="submit" name="submit16" value="Add" onclick="move7()">
</div>
</div>
</form>
data_fetch.php
<?php
$con=mysqli_connect("localhost","root","","forestdb");
if(isset($_POST['submit16'])){
$location=$_POST['location'];
$area1=$_POST['area1'];
$type_of_nursery=$_POST['type_of_nursery'];
$central_nursery_name=$_POST['central_nursery_name'];
$state_nursery_name=$_POST['state_nursery_name'];
$mother_bed_size=$_POST['mother_bed_size'];
$quantity_m=$_POST['quantity_m'];
$source_of_seed=$_POST['source_of_seed'];
$polypot_bed_size=$_POST['polypot_bed_size'];
$quantity_p=$_POST['quantity_p'];
$hycopot_bed_size=$_POST['hycopot_bed_size'];
$quantity_h=$_POST['quantity_h'];
$query="SELECT plantation_journal_no from plantation_journal_basic_details where plantation_journal_no=(select max(plantation_journal_no) from plantation_journal_basic_details);";
$res=mysqli_query($con,$query);
$row=mysqli_fetch_assoc($res);
$plantation_journal_no=$row['plantation_journal_no'];
$sql="INSERT INTO `plantation_journal_nursery_details`(`plantation_journal_no`, `location`, `area`, `type_of_nursery`, `central_nursery_name`, `state_nursery_name`, `mother_bed_size`, `quantity`, `source_of_seed`, `polypot_bed_size`, `quantity_p`, `hycopot_bed_size`, `quantity_h`) VALUES ('$plantation_journal_no','$location','$area1','$type_of_nursery','$central_nursery_name','$central_nursery_name','$mother_bed_size','$quantity_m','$source_of_seed','$polypot_bed_size','$quantity_p','$hycopot_bed_size','$quantity_h');";
$result=mysqli_query($con,$sql);
if($result){
echo "<script>alert('data submitted.');</script>";
header("Location:create_journal.php");
}
}
?>

Your insert query, before you edited your question, contained ...
...VALUES ('$plantation_journal_no',$configurarion','$slope','$water_table_in_...
Notice that your single quotes aren't matched. You should have
...VALUES ('$plantation_journal_no','$configurarion','$slope','$water_table_in_...
If you had checked for an error in your query you would have found this problem immediately. Code like this would have helped.
if($result){
echo "<script>alert('data submitted.');</script>";
header("Location:create_journal.php");
}
else {
die $mysqli->error;
}
Pro tip: Format your code so you don't have to scroll horizontally to see entire queries. It's far easier to examine your queries and find mistakes that way. You can use php's heredoc syntax for string constants to do that.
This is how it looks.
$sql= <<<INSERTQUERY
INSERT INTO `plantation_journal_nursery_details`
(`plantation_journal_no`, `location`, `area`, `type_of_nursery`,
`central_nursery_name`, `state_nursery_name`, `mother_bed_size`,
`quantity`, `source_of_seed`, `polypot_bed_size`, `quantity_p`,
`hycopot_bed_size`, `quantity_h`)
VALUES
('$plantation_journal_no','$location','$area1','$type_of_nursery',
'$central_nursery_name','$central_nursery_name','$mother_bed_size',
'$quantity_m','$source_of_seed','$polypot_bed_size','$quantity_p',
'$hycopot_bed_size','$quantity_h');
INSERTQUERY;

Related

how two column page with form and table css to work in mobile

After more than a month of coding I though I'm already finish it that's why I put it on hosting already, but after I check it on my mobile phone it shock me of the result :(
This is the result in mobile
Form image
Form image with table
anyone can give me an idea on what should I do? i dont want to make from scratch again this is my css, this is two column in 1 page with form in the left and table in the right
body {
font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
h3 {
position:relative;
text-align: center;
margin: 0;
font-size: 32px;
color: #fff;
z-index: 2;
}
.column {
float: left;
padding: 10px;
}
.left {
padding: 25px;
margin: 25px;
width: 40%;
border-radius: 5px;
box-shadow: 1 2px 5px #f5f5f5;
background: white;
border: solid 1px #ccc;
border: 2px solid dodgerblue;
}
.right {
padding: 25px;
margin: 25px;
width: 50%;
border-radius: 5px;
box-shadow: 1 2px 5px #f5f5f5;
background: white;
border: 2px solid dodgerblue;
}
.row:after {
content: "";
display: table;
clear: both;
}
input[type="text"]
{
display: inline-block;
float: left;
padding: 12px; line-height: 5px;
margin: 5px;
height: 40px;
}
label {
display: inline-block;
width: 150px;
padding-left: 5px
}
.main-block {
display: flex;
justify-content: center;
min-height: 100vh;
background-color: #85C1E9;
}
.btn-block {
margin-top: 10px;
text-align: center;
}
button {
outline: none;
font-family: Roboto, Arial, sans-serif;
border: none;
border-radius: 5px;
background: #00BFFF;
font-size: 50px;
color: #fff;
cursor: pointer;
}
button:hover {
background: cyan;
}
.msg {
margin: 30px auto;
padding: 10px;
border-radius: 5px;
color: #3c763d;
background: #dff0d8;
border: 1px solid #3c763d;
width: 50%;
text-align: center;
}
.mix3 {
margin: 0px;
width: 100%;
border-width: strong;
padding: 10px 10px;;
}
This is the form
<div class="main-block">
<div class="column left">
<i class="fa fa-window-restore"></i>
<div class="mix3">
<h5 style="text-align: center; margin-bottom:-10px"><b style="color:red"> STATUS:<a style="color:blue"> <?php echo $status; ?></a></b></h5>
</div>
<form name="frmUser" method="post">
<div><?php if(isset($message)) { echo $message; } ?>
</div>
<div >
<h3><b>Payment Voucher Form </b></h3>
</div>
<div style="margin-bottom:10px; margin-top:20px; " class="bootstrap-demo">
<label style="margin-left: 20px; font-weight: bold;" class="checkbox-inline"> <!-- class checkbox-inline to display checkbox inline -->
<!-- input type checkbox -->
<input type="checkbox" id="cashbox" value="Cash"> Cash
</label>
<label style="margin-left: -50px; font-weight: bold;" class="checkbox-inline">
<input type="checkbox" id="chequebox" value="Cheque"> Cheque
</label>
<label style="margin-left: -50px; margin-right: -30px; font-weight: bold;" class="checkbox-inline">
<input type="checkbox" id="banktransferbox" value="BankTransfer"> Bank Transfer
</label>
</div>
<input type="hidden" name="userid" class="txtField" value="<?php echo $row['ID']; ?>">
<div class="form-row">
<input type="hidden" name="id" class="txtField" value="<?php echo $row['ID']; ?>">
<div class="col-md-7 mb-2">
<label>Payment Voucher ID</label>
<input placeholder="Payment Voucher ID" id ="pv_no" type="text" name="pvid" class="form-control" value="<?php echo $row['PViD']; ?>">
</div>
<div class="col-md-5 mb-2">
<label>Date</label>
<input placeholder="Date" type="text" id="pvdate" name="pvdate" class="form-control" value="<?php echo $row['PVDate']; ?>">
</div>
<div class="col-md-7 mb-2">
<label>Paid to</label>
<input placeholder="Paid to" type="text" name="pvname" class="form-control" value="<?php echo $row['Name']; ?>">
</div>
<div class="col-md-5 mb-2">
<label>Contact No.</label>
<input placeholder="Contact #" type="text" name="contactnumber" class="form-control" value="<?php echo $row['ContactNumber']; ?>">
</div>
<div class="mb-2" style="padding-left: 20px">
<label>The Sum of</label>
<textarea placeholder="The Sum of" name="suminwords" class="form-control"><?php echo $row['SumInWords']; ?></textarea>
</div>
<div class="mb-2" style="padding-left: 20px">
<label>In Respect of</label>
<textarea placeholder="Respectof" name="respectof" class="form-control"><?php echo $row['RespectOf']; ?></textarea>
</div>
<div class="col-md-6 mb-2">
<label>Price</label>
<input placeholder="Total" type="text" name="price" class="form-control" value="<?php echo $row['Price']; ?>">
</div>
<div class="col-md-6 mb-2" >
<label>Cash</label>
<input placeholder="Cash" type="text" name="cash" class="form-control" value="<?php echo $row['Cash']; ?>">
</div>
<div class="col-md-6 mb-2" style="float:right">
<label>Bank Name</label>
<input placeholder="Bank Name" type="text" name="bankname" class="form-control" value="<?php echo $row['BankName']; ?>">
</div>
<div class="col-md-6 mb-2">
<label>VAT 5%</label>
<input placeholder="VAT" type="text" name="vat" class="form-control" value="<?php echo $row['VAT']; ?>">
</div>
<div class="col-md-6 mb-2">
<label>Total</label>
<input placeholder="Total" type="text" name="total" class="form-control" value="<?php echo $row['Total']; ?>">
</div>
<div class="col-md-6 mb-2">
<label>Cheque No</label>
<input placeholder="Cheque No" type="text" name="chequenumber" class="form-control" value="<?php echo $row['ChequeNumber']; ?>">
</div>
<div class="col-md-6 mb-2" style="float:right">
<label>Cheque Date</label>
<input placeholder="Cheque Date" type="text" id="cheque_date" name="chequedate" class="form-control" value="<?php echo $row['ChequeDate']; ?>">
</div>
<div style="margin-bottom: 150px"> </div>
<label class="col-md-8"> Remarks</label>
<div class="mb-2" style="padding-left: 20px">
<textarea placeholder="Remarks" name="remarks" class="form-control"><?php echo $row['Remarks']; ?></textarea>
</div>
<br>
<div class="col-md-6 mb-2" style="float:right">
<label>Prepared By </label>
<input placeholder="Cheque No." type="text" name="preparedby" class="form-control" value="<?php echo $row['PreparedBy']; ?>">
</div>
<div class="col-md-6 mb-2" style="float:right">
<label>Approved By </label>
<input placeholder="Cheque No." type="text" name="approvedby" class="form-control" value="<?php echo $row['ApprovedBy']; ?>">
</div>
<br><br><br><br><br>
<div class="col-md-6 mb-2" style="float:right">
<label>Received By </label>
<input placeholder="Received By" type="text" name="receivedby" class="form-control" value="<?php echo $row['ReceivedBy']; ?>">
</div>
</div>
<div class="col-md-10 mb-1">
<div class="btn-block">
<button style="width:40%; padding: 10px; box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19); color:black; margin-left: 20px" type="submit" name="submit" value="Submit"><b>Update / Add Record</b></button>
</div>
</div>
</form>
<button onclick="location.href='/payment-voucher'" type="button" style="width:30%; color:white; box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19); background-color:red; font-size: 15px; float:right; padding: 15px;"><b>Clear</b></button>
</div>
<div class="column right">
<i class="fa fa-window-restore"></i>
<div>
<h3><b>Payment Voucher List </b></h3>
</div>
<div class="col-md-6">
<input size="50" type="text" name="search" id="search" class="form-control" placeholder="Search name.." />
</div>
<br><br><br>
<div class="col-md-4">
<input type="text" name="from_date" id="from_date" class="form-control" placeholder="From Date" />
</div>
<div class="col-md-4">
<input type="text" name="to_date" id="to_date" class="form-control" placeholder="To Date" />
</div>
<div class="col-md-5">
<input type="button" name="filter" id="filter" value="Search" class="btn btn-info" />
</div>
<div style="clear:both"></div>
<br>
<div id="pvoucher">
<table class="table table-bordered">
<tr style="background-color: #85C1E9; color:white; ">
<th>ID</th>
<th>PVID</th>
<th>PVDate</th>
<th>Name</th>
<th>Update</th>
<th>Delete</th>
<th>Print</th>
</tr>
</table>
<?php if (isset($_SESSION['message'])):
$e = $_SESSION['message'];
?>
<div class="msg">
<?php
$e = $_SESSION['message'];
echo '<tr>';
echo '<td colspan="5">'. $e . '</td>';
echo '</tr>';
unset($_SESSION['message']);
?>
</div>
<?php endif
?>
</div>
</div>
</div>
You should use #media and for example when width of window is smaller than 700px set one column. You should also add meta tag to your html to give browser tips how should scal your website on mobile phones.
<meta name="viewport" content="width=device-width, initial-scale=1.0">

Centring HTML Objects - This includes labels, text input boxes and buttons?

Hello fellow programmers, I have created a search form for my webpage which allows users to use three different fields to refine their search. I have been trying to align these objects with the main heading of the search page. I have tried many different methods but seems to move the objects into the centre. It's really bugging me and I have no clue in how to fix this! Any recommendations?
<p style="text-align:center">View Recipes which satisfy the following criteria:</p>
<div class="container cols justify-content center">
<div style="margin-bottom: 30px; width: 300px;">
<label for="author">By Author:</label>
<select name="author" id="author">
<option value="">Any Author</option>
<?php foreach ($authors as $author): ?>
<option value="<?php html($author['id']);?>"><?php html($author['name']);?></option>
<?php endforeach;?>
</select>
</div>
<div style="margin-bottom: 30px; width: 300px;">
<label for="category">By Category:</label>
<select name="category" id="category">
<option value="">Any Category</option>
<?php foreach ($categories as $category): ?>
<option value="<?php html($category['id']);?>"><?php html($category['name']);?></option>
<?php endforeach;?>
</select>
</div>
<div style="margin-bottom: 30px; width: 300px;">
<label for="text">Containing Text:</label>
<input type="text" name="text" id="text">
</div>
<div style="margin-bottom: 30px; width: 300px;">
<input class="btn btn-primary" type="submit" name="action" value="Search">
</div>
</div>
</form>
</div>
Change the margin-bottom: 30px; on all 4 div to margin: 30px auto;
If you want the align to centre then also add text-align:center; along with this margin: 30px auto;
Codepen: https://codepen.io/manaskhandelwal1/pen/PoGdxpa

after submitting the values in the database table are not updated

I am new to PHP. When I am trying to update or modify my form then it is not getting updated in the phpmyadmin database table. I am using AJAX, jQuery, and PHP. I am badly stuck here so can anyone guide me that how to solve this issue. Thanks in advance. Following are the codes guys.
update_details.php
<div class="panel-body">
<?php
$q1="SELECT * FROM `plantation_journal_basic_details` WHERE `plantation_journal_no`='$plantation_journal_no' ";
$r1=mysqli_query($con,$q1);
$ro1=mysqli_fetch_array($r1);
?>
<form id="form1" action="update_details.php?id='<?php echo $plantation_journal_no; ?>'" name="form1" method="post">
<div class="row">
<div class="col-sm-4">
<h4 style="font-size: 16px;"><b>Basic Details:</b></h4><br>
<div align="right" style="padding-right: 10px;" >
<div align="right" style="padding-right: 10px;" >
<label style="font-weight:300;font-size: 15px">Scheme:</label>
<label align="left" style="width:50%;margin-left: 10px;font-weight:300;font-size: 15px"><?php echo $ro1['scheme']; ?></label><br><br>
<label style="font-weight:300;font-size: 15px">Year:</label>
<label align="left" style="width:50%;margin-left: 10px;font-weight:300;font-size: 15px"><?php echo $ro1['year']; ?></label><br><br>
<label style="font-weight:300;font-size: 15px">Range:</label>
<label align="left" style="width:50%;margin-left: 10px;font-weight:300;font-size: 15px"><?php echo $ro1['ranges']; ?></label><br><br>
<label style="font-weight:300;font-size: 15px">Beat:</label>
<label align="left" style="width:50%;margin-left: 10px;font-weight:300;font-size: 15px"><?php echo $ro1['beat']; ?></label><br><br>
<label style="font-weight:300;font-size: 15px">JFMC:</label>
<label align="left" style="width:50%;margin-left: 10px;font-weight:300;font-size: 15px"><?php echo $ro1['jfmc']; ?></label><br><br>
<label style="font-weight:300;font-size: 15px">Panchayat Samity:</label>
<label align="left" style="width:50%;margin-left: 10px;font-weight:300;font-size: 15px"><?php echo $ro1['panchayat_samity']; ?></label><br><br>
<label style="font-weight:300;font-size: 15px">Gram Panchayat:</label>
<label align="left" style="width:50%;margin-left: 10px;font-weight:300;font-size: 15px"><?php echo $ro1['gram_panchayat']; ?></label><br><br>
</div>
</div>
</div>
<div class="col-sm-4">
<h4 style="font-size: 16px;"><b>GPS Coordinates:</b></h4><br>
<div align="right" style="padding-right: 10px;" >
<label style="font-weight:300;font-size: 15px">Latitude:</label>
<input type="text" name="latitude_degree" value="<?php echo $ro1['latitude_degree']; ?>" style="width:10%;height: 30px; margin-left: 10px; border-radius: 5px; padding: 0 0 0 1px;">
<label style="font-weight:300;font-size: 15px">°</label>
<input type="text" name="latitude_minute" value="<?php echo $ro1['latitude_minute']; ?>" style="width:10%;height: 30px; margin-left: 10px; padding: 0 0 0 1px; border-radius: 5px;">
<label style="font-weight:300;font-size: 15px">'</label>
<input type="text" name="latitude_second" value="<?php echo $ro1['latitude_second']; ?>" style="width:10%;height: 30px; margin-left: 10px; border-radius: 5px; padding: 0 0 0 1px;">
<label style="font-weight:300;font-size: 15px">"</label><br>
<label style="font-weight:300;font-size: 15px">Longitude:</label>
<input type="text" name="longitude_degree" value="<?php echo $ro1['longitude_degree']; ?>" style="width:10%;height: 30px; margin-left: 10px; border-radius: 5px; padding: 0 0 0 1px;">
<label style="font-weight:300;font-size: 15px">°</label>
<input type="text" name="longitude_minute" value="<?php echo $ro1['longitude_minute']; ?>" style="width:10%;height: 30px; margin-left: 10px; border-radius: 5px; padding: 0 0 0 1px;">
<label style="font-weight:300;font-size: 15px">'</label>
<input type="text" name="longitude_second" value="<?php echo $ro1['longitude_second']; ?>" style="width:10%;height: 30px; margin-left: 10px; border-radius: 5px; padding: 0 0 0 1px;">
<label style="font-weight:300;font-size: 15px">"</label><br>
</div>
<h4 style="font-size: 16px;"><b>Boundary:</b></h4><br>
<div align="right" style="padding-right: 10px;" >
<label style="font-weight:300;font-size: 15px">North:</label>
<input type="text" name="north" value="<?php echo $ro1['north']; ?>" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
<label style="font-weight:300;font-size: 15px">East:</label>
<input type="text" name="east" value="<?php echo $ro1['east']; ?>" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
<label style="font-weight:300;font-size: 15px">West:</label>
<input type="text" name="west" value="<?php echo $ro1['west']; ?>" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
<label style="font-weight:300;font-size: 15px">South:</label>
<input type="text" name="south" value="<?php echo $ro1['south']; ?>" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
</div>
</div>
<div class="col-sm-4">
<h4 style="font-size: 16px;"><b>Surveyed By:</b></h4><br>
<div align="right" style="padding-right: 10px;" >
<label style="font-weight:300;font-size: 15px">Full Name:</label>
<input type="text" name="full_name_s" value="<?php echo $ro1['ful_name_s']; ?>" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
<label style="font-weight:300;font-size: 15px">Designation:</label>
<input type="text" name="designation_s" value="<?php echo $ro1['designation_s']; ?>" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
</div>
<h4 style="font-size: 16px;"><b>Checked By:</b></h4><br>
<div align="right" style="padding-right: 10px;" >
<label style="font-weight:300;font-size: 15px">Full Name:</label>
<input type="text" name="full_name_c" value="<?php echo $ro1['full_name_c']; ?>" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
<label style="font-weight:300;font-size: 15px">Designation:</label>
<input type="text" name="designation_c" value="<?php echo $ro1['designation_c']; ?>" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
</div>
</div>
</div>
<br>
<div align="right">
<input class="btn btn-info btn-submit8" type="submit" name="submit_1" value="Add" onclick="move1()">
</div>
</form>
<?php
if(isset($_POST['latitude_degree'])){
$latitude_degree=$_POST['latitude_degree'];
$latitude_minute=$_POST['latitude_minute'];
$latitude_second=$_POST['latitude_second'];
$longitude_degree=$_POST['longitude_degree'];
$longitude_minute=$_POST['longitude_minute'];
$longitude_second=$_POST['longitude_second'];
$north=$_POST['north'];
$east=$_POST['east'];
$west=$_POST['west'];
$south=$_POST['south'];
$full_name_s=$_POST['full_name_s'];
$designation_s=$_POST['designation_s'];
$full_name_c=$_POST['full_name_c'];
$designation_c=$_POST['designation_c'];
$sql="UPDATE `plantation_journal_basic_details` SET `latitude_degree`='$latitude_degree',`latitude_minute`='$latitude_minute',`latitude_second`='$latitude_second',`longitude_degree`='$longitude_degree',`longitude_minute`='$longitude_minute',`longitude_second`='$longitude_second',`north`='$north',`east`='$east',`west`='$west',`south`='$south',`ful_name_s`='$full_name_s',`designation_s`='$designation_s',`full_name_c`='$full_name_c',`designation_c`='$designation_c' WHERE `plantation_journal_no`='$plantation_journal_no'";
$result=mysqli_query($con,$sql);
}
?>
A simpler way to submit all your input values is with:
$('#form').ajaxForm({
/*....*/
});
Did you try it?

Why is my input submit of my form not clickable?

I have no idea what's causing the problem. I have a sign up form, and whenever I try to click the "Complete Registration" button, nothing happens! The form isn't even submitted! This is the HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" name="viewport" content="width=device-width, height=device-height, initial-scale = 1">
<title>Signup</title>
<link rel="icon" href="/images/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="/styling/signupstyle.css">
</head>
<body>
<div id="formdiv" method="post">
<h1 id="title">Sign Up Here!</h1>
<form id="form" name="signupform" onsubmit="return false;">
<div class="inputdiv">
<label for="username">Username: </label>
<input name="username" type="text" maxlength="20">
<span id="unamestatus"></span>
</div>
<div class="inputdiv">
<label for="password">Password: </label>
<input type="password" name="pass1" maxlength="20">
</div>
<div class="inputdiv">
<label for="pass2">Confirm Password: </label>
<input type="password" name="pass2" maxlength="20">
</div>
<div class="inputdiv">
<label for="email">Email: </label>
<input name="email" type="text" maxlength="100">
</div>
<div class="inputdiv">
<label for="gender">Gender: </label>
<select name="gender"">
<option value=""></option>
<option value="m">Male</option>
<option value"f">Female</option>
</select>
</div>
<div class="inputdiv">
<label for="country">Country: </label>
<select name="country">
<?php include_once("countries.html"); ?>
</select>
</div>
<div>
<input id="submit" type="submit" name="submit" value="Complete Registration!" style="width: 40%; font-size: 25px; padding: 1% 0;">
</div>
<div style="margin-top: 5%;">
<img src="/images/ConnectionLogo.PNG" alt="Connection" style="width: 25%; height: 25%;">
</div>
</form>
</div>
</body>
</html>
And this is the styling of the form:
body {
width: 100vw;
height: 100vh;
font-size: 25px;
background: linear-gradient(to right, #3DCBF2 , #3DF2D4);
overflow-x: hidden;
overflow-y: hidden;
}
#formdiv {
margin: auto;
width: 50%;
height: 85%;
border: 5px solid #2A67EB;
background-color: #37A3F0;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
}
#form {
width: 70%;
margin: 0 auto;
text-align: center;
height: 90%;
}
#title {
text-align: center;
color: #57E7F7;
margin-top: 1%;
}
#form input {
width: 35%;
font-size: 20px;
background-color: #70D1FA;
border: 3px solid #4187E8;
color: #376BE6;
}
#form select {
width: 25%;
font-size: 20px;
background-color: #70D1FA;
border: 3px solid #4187E8;
color: #376BE6;
}
.inputdiv {
padding-bottom: 5%;
}
#form label {
margin-right: 3%;
color: #3544F0;
font-weight: bold;
}
This is the PHP that isn't finished yet, but is certainly not causing the problem:
if ($_POST['submit']) {
// Receiving data from the form //
$username = preg_replace('#[^a-z0-9]#i', '', $_POST['username']);
$usercheck = mysqli_query($connection, "SELECT * FROM users WHERE username='$username'");
$password = mysqli_real_escape_string($connection, $_POST['pass1']);
$passconfirm = mysqli_real_escape_string($connection, $_POST['pass2']);
$email = mysqli_real_escape_string($connection, $_POST['email']);
$emailcheck = filter_var($email, FILTER_VALIDATE_EMAIL);
$emailcheck2 = mysqli_query($connnection, "SELECT * FROM users WHERE email='$email'");
$gender = mysqli_real_escape_string($connection, $_POST['gender']);
$country = mysqli_real_escape_string($connection, $_POST['country']);
// Now for the check functions //
if ($usercheck != 0) {
die("Sorry, your username is already in use! Redirecting...");
};
if ($password != $passwordconfirm) {
die("The passwords do not match! Redirecting...");
};
if ($emailcheck != 0) {
die("That email is already in use! Redirecting...");
};
};
Because you explicitly cancel the submit action. You say onsubmit="return false;". What are you expecting it to do when you explicitly tell it to do nothing?
Also, sidenote, you have a few HTML issues:
<select name="gender"">
<option value=""></option>
<option value="m">Male</option>
<option value"f">Female</option>
should be:
<select name="gender">
<option value=""></option>
<option value="m">Male</option>
<option value="f">Female</option>

Aligning different elements inside div in html

I am new to php.
And i am using following code to show a form
<div class="wrapperReg">
<div id="searchContainer" style="display: inline; margin-top: 20px">
<form>
<label class="ringSetName" style="font-size: 16pt;" >Firstname</label>
<input id="nameBox" style="width:250px; margin-top:10px; margin-left: 30px; height:30px;" name="q" type="text"/>
</form>
</div>
<div id="searchContainer" style="display: inline; margin-top: 20px">
<form>
<label class="ringSetName" style="font-size: 16pt;" >Lastname</label>
<input id="nameBox" style="width:250px; margin-top:10px; margin-left: 30px; height:30px;" name="q" type="text"/>
</form>
</div>
<div id="searchContainer" style="display: inline; margin-top: 20px">
<form>
<label class="ringSetName" style="font-size: 16pt;" >Email</label>
<input id="nameBox" style="width:250px; margin-top:10px; margin-left:30px; height:30px;" name="q" type="text"/>
</form>
</div>
<div id="searchContainer" style="display: inline; margin-top: 20px">
<form>
<label class="ringSetName" style="font-size: 16pt;" >Phone</label>
<input id="nameBox" style="width:250px; margin-top:10px; margin-left: 30px; height:30px;" name="q" type="text"/>
</form>
</div>
<div class="submit" style="display: inline;" style="margin-top: 10px">
<input type="button" value="Submit" class="submit-text"/>
</div>
CSS is as follow
.wrapperReg{
overflow: hidden;
width: 100%;
height: 100%;
}
It is showing stuff as below
How can i align so that all the elements are aligned horizontally inside the main div and The Text should be base aligned and also the Input fileds be vertically aligned to each.
Also Need to place the submit button aligned horizontally too.
How about using float?
label{float: left;}
label + input{float: right;}
And add overflow:hidden to your form. And wrap your form elements in one form.
label {float: left; width: 200px; clear: left}
label + input {float: left; width: 150px}
ID should be unique in whole document, use class for searchContainer.

Categories