I am a .NET guy. I am asked to fix a PHP form issue, can you please help me to figure-out db connection issue in the code if any.
I have a page connect.php having following code:-
<?php
$link = mysqli_connect("100.100.10.92","CountryCabs_123","Country!23Cabs_123","newdb1");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
Now I've a form with following infomation:-
<?php error_reporting(0); include("connect.php"); ?>
<?php
include('header.php');
?>
<div class="main">
<div style="width:100%;">
<div id="div2">
<div class="head1">Book Your Cab</div>
<div class="content1">
<form name="bookcab" id="bookcab" method="post" >
<table width="100%">
<tr >
<td colspan="4"><div class="titlehead">Local Booking</div></td>
</tr>
<tr>
<td colspan="4"><div><span
style="color:#FF0000">*</span> Mandatory Feilds</div></td>
</tr>
<tr>
<td colspan="4"> <div class="border1"></div></td>
</tr>
<tr>
<td width="15%">CITY</td>
<td width="34%"><select id="size3" name="from3">
<option value="Pune">Pune</option>
</select></td>
<td width="12%" align="right">PACKAGE<span
style="color:#FF0000">*</span></td>
<td width="39%"><select id="size4" name="packages">
<option value="0">Hr/Kms</option>
<?php $select= mysql_query("select * from local_packages");
$i=1;
while($sel= mysql_fetch_assoc($select))
{
?>
<option value="<?php echo
$sel['package_name'];?>"><?php echo $sel['package_name'];?></option>
<?php $i++;}?>
</select></td>
</tr>
<tr>
<td width="15%">Cab Type <span style="color:#FF0000">*</span> :</td>
<td width="39%"><select name="cabtype" id="cabtyp" >
<option value="0">CabType</option>
<option value="Hatchback">HatchBack</option>
<option value="Compact">Compact Sedan</option>
<option value="Sedan">Sedan</option>
<option value="MUV">MUV</option>
</select></td>
</tr>
<tr>
<td colspan="4"> <div class="border1"></div></td>
</tr>
<tr>
<td colspan="4" style="padding-left:5px"><h4>When</h4></td>
</tr>
<tr>
<td style="padding-left:5px">Pickup Date<span
style="color:#FF0000; margin:0px 22px 0px 0px">*</span> : </td>
<td> <span class="k-textbox" style="width:200px"><input
name="datepicker" id="datepicker" class="tcal" value="<?php echo
$_SESSION['date'];?>"/></span></td>
<td width="28%"><span style="padding-left:20px">Pickup Time <span
style="color:#FF0000; margin:0px 35px 0px 0px">*</span> :</td>
<td><input name="timepicker" id="timepicker" value="<?php echo
$_SESSION['time'];?>" style="width:200px"/>
<script>
$(document).ready(function() {
// create TimePicker from input HTML element
$("#timepicker").kendoTimePicker();
});
</script></td>
</tr>
<tr>
<td colspan="4"> <div class="border1"></div></td>
</tr>
<tr>
<td style="padding-left:5px">Pickup Address <span
style="color:#FF0000">*</span> :</td>
<td colspan="3"><select name="pickup" id="pickup"
onchange="selectAdd(this.value)" style="width:200px">
<option value="Home">Home</option>
<option value="Office">Office</option>
<option value="Railway">Railway Station</option>
<option value="Airport">Airport</option>
</select></td>
</tr>
<?php $select= mysql_query("select * from member where
pkey='".$_SESSION['regId']."'");
$selected= mysql_fetch_assoc($select);?>
<tr>
<td > </td>
<td colspan="3"><textarea name="pickupaddress"
class="k-textbox" style="width:300px; height:100px" id="pick"><?php
echo $selected['per_address'];?></textarea></td>
</tr>
<tr>
<td colspan="4"> </td>
</tr>
<tr>
<td colspan="4"><div class="border1"></div></td>
</tr>
<tr>
<td colspan="2" style="padding-left:5px"><h4>Traveller's
Details</h4></td>
<td colspan="2"> </td>
</tr>
<?php $select= mysql_query("select * from member where pkey=
'".$_SESSION['regId']."'");
$list= mysql_fetch_assoc($select); ?>
<tr>
<td colspan="4" ><input type="radio" name="self"
value="self" onclick="addDetails('<?php echo $list['firstname']."
".$list['lastname']?>','<?php echo $list['mobile']; ?>','<?php echo
$list['email'];?>','<?php echo $list['company'];?>')"
checked="checked">
Booking For Self
<input type="radio" name="self" value="other"
onclick="addDetails('','','','')">
Booking For Others</td>
</tr>
<tr>
<td width="18%" style="padding-left:5px">Name
<span style="color:#FF0000 ; margin:0px 52px 0px 0px"> * </span>:</td>
<td><span class="k-textbox" style="width:200px">
<input type="text" name="name" id="name"
value="<?php echo $list['firstname']." ".$list['lastname'];?>" >
</span> </td>
<td width="28%"><span style="margin:0px 0px 0px
20px">Mobile No.<span style="color:#FF0000; margin:0px 47px 0px
0px">*</span> : </span></td>
<td width="38%"><span class="k-textbox" style="width:200px">
<input type="text" name="mobile" id="mobile"
value="<?php echo $list['mobile'];?>" onKeyPress="return
isNumberKey(event)"><script type="text/javascript">function
isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}</script>
</span></td>
</tr>
<tr>
<td width="18%" style="padding-left:5px">Email ID
<span style="color:#FF0000; margin:0px 42px 0px 0px">*</span>: </td>
<td width="18%"><span class="k-textbox" style="width:200px">
<input type="text" name="email" id="email"
value="<?php echo $list['email'];?>">
</span></td>
<td width="28%" ><span style="margin:0px 0px 0px
20px">Company </span><span style="margin:0px 0px 0px
57px">:</span></td>
<td width="38%"><span class="k-textbox" style="width:200px">
<input type="text" name="company" id="company"
value="<?php echo $list['company'];?>">
</span></td>
</tr>
<tr>
<td style="padding-left:5px">Lead<span style="margin:0px
0px 0px 69px">:</span></td>
<td colspan="3"> <select name="lead" id="lead" style="width:200px">
<option value="0">Select</option>
<option value="Website">Website</option>
<option value="Referal">Referal</option>
<option value="Facebook">Facebook</option>
<option value="Twitter">Twitter</option>
<option value="LinkedIn">LinkedIn</option>
<option value="Others">Others</option>
</select> </td>
</tr>
<tr>
<td colspan="4" style="padding-left:5px"><div id="planes"
style="display:none;"> Flight No.: <span class="k-textbox"
style="margin:0px opx 0px 69px">
<input type="text" name="planess" id="planess"
value="" style="width:195px">
</span> </div>
<div id="train" style="display:none;"> Train
No.: <span class="k-textbox"
style="margin-left:50px;width:200px" >
<input type="text" name="trainNo" id="trainNumber"
value="" style="width:195px">
</span> </div></td>
</tr>
<tr>
<td valign="top" style="padding-left:5px">Special
Requirements<span style="margin:0px 0px 0px 18px">:</span></td>
<td colspan="3" >
<textarea class="k-textbox" style="width:300px;
height:100px" id="requ" placeholder="Eg: Clean and Ac Car"></textarea>
</td>
</tr>
<tr>
<td ></td>
<td colspan="3">
<input type="button" name="book" id="book" value=" Book "
onclick="confirm_book_local()" style="float:inherit"
class="btn"></td>
</tr>
</table>
</form>
</div>
</div>
<!--------confim------->
<div style="display:none;" id="div3">
<div class="head1">Booking Details</div>
<div class="content1">
<form name="confirmation" id="confirmation" method="post"
action="submit-form-local.php">
<table width="100%" height="auto" border="0" cellpadding="6"
cellspacing="0" >
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="22%"><strong>Traveller's Name</strong></td>
<td width="2%"><strong>:</strong></td>
<td width="72%"> <input type="text" name="dname" id="dname"
style="border:none; background-color:transparent; width:400px;"
readonly/></td>
</tr>
<tr>
<td>
<span style="margin:0px 30px 0px 0px; font-weight:bold">Email
ID</span> </td>
<td><strong>:</strong></td>
<td><span style="font-size:12px; font-weight:bold" ><input
type="text" id="dmail" name="dmail" style="border:none;
background-color:transparent; width:220px;" readonly></span></td>
</tr>
<tr>
<td>
<span style="margin:0px 30px 0px 0px;font-weight:bold">Mobile
No</span> </td>
<td><strong>:</strong></td>
<td><span style="font-size:12px; font-weight:bold" >
<input type="text" id="dmobile" name="dmobile"
style="border:none ;background-color:transparent; width:150px;"
readonly/>
</span></td>
</tr>
<tr>
<td>
<span style="margin:0px 30px 0px 0px;font-weight:bold">Cab
Type</span> </td>
<td><strong>:</strong></td>
<td><span style="font-size:12px; font-weight:bold" >
<input type="text" id="dcabtype" name="dcabtype"
style="border:none ;background-color:transparent; width:150px;"
readonly/>
</span></td>
</tr>
<tr>
<td ><h4>City</h4></td>
<td ><strong>:</strong></td>
<td><input type="text" name="city" value="Pune"
style="border:none;background-color:transparent;" readonly/></td>
</tr>
<tr>
<td><h4>Pickup Address</h4></td>
<td><strong>:</strong></td>
<td ><input type="text" name="dpick" id="dpick"
style="border:none;background-color:transparent;" readonly/></td>
</tr>
<td><h4>Departure Date</h4></td>
<td><strong>:</strong></td>
<td ><input type="text" name="Pdate" id="Pdate"
style="border:none;background-color:transparent;" readonly/></td>
</tr>
<td><h4>Departure Time</h4></td>
<td><strong>:</strong></td>
<td ><input type="text" name="Ptime" id="Ptime"
style="border:none;background-color:transparent;" readonly/></td>
</tr>
<tr>
<td><h4>Special Requirements</h4></td>
<td><strong>:</strong></td>
<td><input type="text" id="special" name="special"
style="border:none;background-color:transparent;" readonly/></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td ><input type="checkbox" name="accept" id="accept">
I have Read And Accept The <a href="termsconditions.php"
target="_blank">Terms And Conditions</a></td>
</tr>
<tr>
<td></td>
<td></td>
<td><input type="radio" name="pay" value="cos"
onchange="display_message(1)" checked="checked">
<strong>Cash On Service</strong>
<input type="radio" name="pay" value="pay_now"
onchange="display_message(2)">
<strong> Pay Online</strong></td>
</tr>
<tr>
<td></td>
<td></td>
<td id="m1" style="display:none; color:#FF0000">Extremely Sorry!
Online payment mode is temporarily down, please select cash on
service as of now. We regret for the inconvenience you had.</td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<input type="submit" name="confirm" id="con1"
value="Confirm" style="float:left;margin-right:20px;" class="btn"
onclick="validCondition()">
<input type="button" name="back" value="Back" style="float:left;"
class="btn" onclick="bookback()"> </td>
</tr>
<tr>
<td></td>
<td></td>
<td style="margin-left:20px">You can cancel your booking
anytime. Please read our <a href="cancellation_ privacy.php"
target="_blank">cancellation policy</a> for more details.</td>
</tr>
<tr><td><input type="hidden" name="hiddencarId" value="<?php echo
$_GET['id'];?>"></td>
<td> </td>
</tr>
</table>
</div>
</div>
</div>
<div class="clear"></div>
<?php include('footer.php');?>
<script>
document.getElementById('li05').classList.add('active');
</script>
There is some user accessibility issue on database, we are using GoDaddy. I verified the credentials on MySQL Workbench i can connect database. Can you please verify if any issue in code.
You're mixing mysqli with mysql. Should be using mysqli only instead of mysql, which is already deprecated. And when using mysqli, it is best (and a must) to be doing prepared statement on it to prevent SQL injections.
I'll be doing the first drop down for an example, so you can have an idea and do the rest.
<select id="size4" name="packages">
<option value="0">Hr/Kms</option>
<?php
$select= "SELECT package_name FROM local_packages";
if($stmt=$link->prepare($select)){
$stmt->execute();
$stmt->bind_result($packagename); /* BIND THE RESULT */
$i=1;
while($stmt->fetch()){ /* FETCH RESULTS */
printf("<option value='%s'>%s</option>",$packagename,$packagename);
$i++;
} /* END OF WHILE LOOP */
$stmt->close();
}
?>
</select>
I still included the $i variable. Maybe you have other purpose for it.
Related
I want to update my older entries through PHP interface in MongoDB.
First I get data from the text fields and then store that into variables and then using those variables to update data in Mongodb here is my code please help me i tried all ways but every time disappointment.
<?php
if(isset($_REQUEST['btn']))
{
$a=$_REQUEST['textfield'];
$b=$_REQUEST['textfield2'];
$c=$_REQUEST['textfield3'];
$d=$_REQUEST['textfield4'];
$e=$_REQUEST['textfield5'];
$f=$_REQUEST['textfield6'];
$g=$_REQUEST['textfield7'];
$h=$_REQUEST['textfield8'];
$m = new MongoClient(); // connect to mongodb
$db = $m->app; // select a database named app
$collection = $db->lafaz;
$db->lafaz->update(array("_id"=> new MongoID($a)),$doct, array('multiple' => true));
header('Location:page.php');
}?>
<!doctype html>
<html>
<head>
<style type="text/css">
header a {
font-weight: bold;
font-family: Sarina;
font-size: 45pt;
font-style: oblique;
text-decoration: none;
text-shadow: 2px 2px #33CCFF;
color: #369;
}
</style>
<link href="form.css" rel="stylesheet" type="text/css" />
<meta charset="utf-8">
<title>Edit Word</title>
</head>
<body>
<div>
<header align="center">Tarmeem -e- Haraf </header>
<nav align="center">
</nav>
<div align="right" >
<?php
$m = new MongoClient();
$db = $m->app;
$collection = $db->lafaz;
$id=$_REQUEST['_id'];
$cursor = $collection->find(array("_id"=> new MongoID($id)));
foreach ($cursor as $obj)
{
?>
<form action="#" method="post">
<table width="100%" class="top-table" >
<tr>
<td width="40%" align="right"><p>ID:</p></td>
<td width="3%"> </td>
<td width="57%" align="left">
<input class="tf" type="text" name="textfield" id="textfield" readonly value=" <?php echo $obj["_id"]; ?> " ></td>
</tr>
<tr>
<td align="right"><p>Encoding:</p></td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="textfield2" id="textfield2" required value=" <?php echo $obj["Encoding"]; ?> " ></td>
</tr>
<tr>
<td align="right"><p>Pos:</p> </td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="textfield3" id="textfield3" required value=" <?php echo $obj["Pos"]; ?> " ></td>
</tr>
<tr>
<td align="right"><p>Roman: </p></td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="textfield4" id="textfield4" required value=" <?php echo $obj["Roman"]; ?> " ></td>
</tr>
<tr>
<td align="right"><p>Important: </p></td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="textfield5" id="textfield5" required value=" <?php echo $obj["Important"]; ?> " ></td>
</tr>
<tr>
<td align="right"><p>Hindi: </p></td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="textfield6" id="textfield6" required value=" <?php echo $obj["Hindi"];; ?> " ></td>
</tr>
<tr>
<td align="right"><p>English: </p></td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="textfield7" id="textfield7" required value=" <?php echo $obj["English"]; ?> " ></td>
</tr>
<tr>
<td align="right"><p>Type: </p></td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="textfield8" id="textfield8" required value=" <?php echo $obj["Type"]; ?> " ></td>
</tr>
</table>
<input name="btn" id="btn" class="button" type="submit" value="Save"></td>
<?php } ?>
</form>
</div>
</div>
</body>
</html>
Here is a fully working page, commented up so you can follow me. You will need to update your PHP runtime to a newer version by the sounds of it but that should already be done, especially since PHP is always backwards compatible currently.
$m = new \MongoClient();
$db = $m->app;
$collection = $db->lafaz;
// Better to sometimes actually check the right array, especially if someone wants to attack
// you by tricking PHP into combining the REQUEST from the GET
if(isset($_POST['btn'])){
// We take the $_POST piece by piece, do a trim to strip white space
// and then we add it to the doc array ready for use in MongoDB
// Of course this is not good practice for production programs but
// it is somewhere to start
$doc = [];
foreach($_POST as $k => $v){
$doc[$k] = trim($v);
}
// This will detect if we are updating or not, if no a is set then no _id was passed
if(isset($doc['_id'])){
// Some validation to ensure that we have a valid MongoID, consider it free knowledge
try{
$_id = new \MongoId($doc['_id']);
}catch(\Exception $e){
throw new \Exception('The _id inputted was not valid: ' . var_export($doc['_id'], true));
}
// Unset the _id as to not raise an error
unset($doc['_id']);
// Could do an upsert here but, meh, I prefer the logic displayed here
$collection->update(["_id"=> $_id], ['$set' => $doc], ['multiple' => true]);
}else{
$collection->insert($doc);
}
// We redirect to somewhere
header('Location:page.php');
// stop further processing and just send the damn headers
exit();
}
// If there is a _id in the REQUEST array
if(isset($_REQUEST['_id'])){
// Some validation to ensure that we have a valid MongoID, consider it free knowledge
try{
$_id = new \MongoId($_REQUEST['_id']);
}catch(\Exception $e){
throw new \Exception('The _id inputted was not valid: ' . var_export($_REQUEST['_id'], true));
}
// We find the one we just did, btw your code atm means this never happens...
$cursor = $collection->find(["_id"=> new \MongoID($_id)]);
}else{
// We just find all
$cursor = $collection->find();
}
?>
<!doctype html>
<html>
<head>
<style type="text/css">
header a {
font-weight: bold;
font-family: Sarina;
font-size: 45pt;
font-style: oblique;
text-decoration: none;
text-shadow: 2px 2px #33CCFF;
color: #369;
}
</style>
<link href="form.css" rel="stylesheet" type="text/css" />
<meta charset="utf-8">
<title>Edit Word</title>
</head>
<body>
<div>
<header align="center">Tarmeem -e- Haraf </header>
<nav align="center">
</nav>
<div align="right">
<!-- Add a new one form. There are better ways to do this but this is just to get it working -->
<form action="#" method="post">
<table width="100%" class="top-table" >
<tr>
<td align="right"><p>Encoding:</p></td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="Encoding" id="textfield2" required></td>
</tr>
<tr>
<td align="right"><p>Pos:</p> </td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="Pos" id="textfield3" required></td>
</tr>
<tr>
<td align="right"><p>Roman: </p></td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="Roman" id="textfield4" required></td>
</tr>
<tr>
<td align="right"><p>Important: </p></td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="Important" id="textfield5" required></td>
</tr>
<tr>
<td align="right"><p>Hindi: </p></td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="Hindi" id="textfield6" required></td>
</tr>
<tr>
<td align="right"><p>English: </p></td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="English" id="textfield7" required></td>
</tr>
<tr>
<td align="right"><p>Type: </p></td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="Type" id="textfield8" required></td>
</tr>
</table>
<input name="btn" id="btn" class="button" type="submit" value="Create">
</form>
<?php foreach ($cursor as $obj){ ?>
<form action="#" method="post">
<table width="100%" class="top-table" >
<tr>
<td width="40%" align="right"><p>ID:</p></td>
<td width="3%"> </td>
<td width="57%" align="left">
<input class="tf" type="text" name="_id" id="textfield" readonly value="<?= $obj["_id"] ?>"/></td>
</tr>
<tr>
<td align="right"><p>Encoding:</p></td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="Encoding" id="textfield2" required value="<?= $obj["Encoding"] ?> "/></td>
</tr>
<tr>
<td align="right"><p>Pos:</p> </td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="Pos" id="textfield3" required value="<?= $obj["Pos"] ?>"/></td>
</tr>
<tr>
<td align="right"><p>Roman: </p></td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="Roman" id="textfield4" required value="<?= $obj["Roman"] ?>"/></td>
</tr>
<tr>
<td align="right"><p>Important: </p></td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="Important" id="textfield5" required value="<?= $obj["Important"] ?>"/></td>
</tr>
<tr>
<td align="right"><p>Hindi: </p></td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="Hindi" id="textfield6" required value="<?= $obj["Hindi"] ?>"/></td>
</tr>
<tr>
<td align="right"><p>English: </p></td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="English" id="textfield7" required value="<?= $obj["English"] ?>"/></td>
</tr>
<tr>
<td align="right"><p>Type: </p></td>
<td> </td>
<td align="left">
<input class="tf" type="text" name="Type" id="textfield8" required value="<?= $obj["Type"] ?>"/></td>
</tr>
</table>
<input name="btn" id="btn" class="button" type="submit" value="Save">
</form>
<?php } ?>
</div>
</div>
</body>
</html>
<?php
Thank you for taking the time to read/answer this.
First thing: my career page has a pre-made contact form that i turned into a job application. I have two layout questions:
1.) How do i get the 'checkbox' buttons to line up a little closer to each other. I tried td colspan="2" which is the case later in the form for 2 buttons (submit/reset 1 which i removed), but to no avail, "No" appears well to the right of "Yes." I'd like to have it relatively closer to "Yes."
2.) When you pull the drop down for "Experience" down, it forces the image below the form. Once you select your option, the image goes back to its place. Do i absolutely have to absolute position the graphic? Or can i add an overflow maybe to the dropdown? I can't figure it out.
FancyForm is the form i'm using.
Here is the HTML:
<form id="contact-form" name="contact-form" method="post" action="submit.php">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="15%"><label for="name">Name</label></td>
<td width="70%"><input type="text" class="validate[required,custom[onlyLetter]]" name="name" id="name" value="<?=$_SESSION['post']['name']?>" /></td>
<td width="15%" id="errOffset"> </td>
</tr>
<tr>
<td width="15%"><label for="address">Address</label></td>
<td width="70%"><input type="text" class="validate[required,custom[a-zA-Z\d\s\-\,\#\.\+]+]" name="address" id="address" value="<?=$_SESSION['post']['address']?>" /></td>
<td width="15%" id="errOffset"> </td>
</tr>
<tr>
<td width="15%"><label for="telephone">Telephone</label></td>
<td width="70%"><input type="text" class="validate[required,custom[onlyNumber]]" name="telephone" id="telephone" value="<?=$_SESSION['post']['telephone']?>" /></td>
<td width="15%" id="errOffset"> </td>
</tr>
<tr>
<td width="15%"><label for="email">Email</label></td>
<td width="70%"><input type="text" class="validate[required,custom[email]]" name="email" id="email" value="<?=$_SESSION['post']['email']?>" /></td>
<td width="15%" id="errOffset"> </td>
</tr>
<tr>
<td width="15%"><label for="citizenship">US Citizen</label></td>
<td width="35%"><input type="checkbox" name="citizen" value="yes">Yes</td>
<td width="35%"><input type="checkbox" name="citizen" value="no">No</td>
<td width="15%" id="errOffset"> </td>
</tr>
<tr>
<td width="15%"><label for="age">At Least 18</label></td>
<td width="35%"><input type="checkbox" name="age" value="yes">Yes</td>
<td width="35%"><input type="checkbox" name="age" value="no">No</td>
<td width="15%" id="errOffset"> </td>
</tr>
<tr>
<td width="15%"><label for="previousexp">Have you worked<br> with us before?</label></td>
<td width="35%"><input type="checkbox" name="previousexp" value="yes">Yes
<td width="35%"><input type="checkbox" name="previousexp" value="no">No</td>
<td width="15%" id="errOffset"> </td>
</tr>
<tr>
<td width="15%"><label for="subject">Experience</label></td>
<td width="70%"><select name="subject" id="subject">
<option value="" selected="selected"> - Choose -</option>
<option value="0-5">0-5 Years</option>
<option value="6-10">6-10 Years</option>
<option value="11-15">11-15 Years</option>
<option value="16-20">16-20 Years</option>
</select></td>
<td width="15%" id="errOffset"> </td>
</tr>
<tr>
<td><label for="captcha"><?=$_SESSION['n1']?> + <?=$_SESSION['n2']?> =</label></td>
<td><input type="text" class="validate[required,custom[onlyNumber]]" name="captcha" id="captcha" /></td>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top"> </td>
<td colspan="2"><input type="submit" name="button" id="button" value="Submit" />
<?=$str?> <img id="loading" src="img/ajax-load.gif" width="16" height="16" alt="loading" /></td>
</tr>
</table>
</form>
CSS:
#form-container{
padding:0px;
}
td{
white-space:nowrap;
}
h1{
color:#777777;
font-size:22px;
font-weight:normal;
text-transform:uppercase;
margin-bottom:5px;
}
h2{
font-weight:normal;
font-size:10px;
text-transform:uppercase;
color:#aaaaaa;
margin-bottom:15px;
border-bottom:1px solid #484848;
margin-bottom:15px;
}
label{
text-transform:uppercase;
font-size:10px;
font-family:Tahoma,Arial,Sans-serif;
}
textarea{
color:#404040;
font-family:Arial,Helvetica,sans-serif;
font-size:12px;
}
td > button{
text-indent:8px;
}
Thank you very much for trying to help <3
Remove overflow:auto from id #wrapper for your image problem
For your first question, you can simply place both checkboxes in the same <td></td> to get them side-by-side. Change the code to:
<td width="35%"><input type="checkbox" name="citizen" value="yes">Yes<input type="checkbox" name="citizen" value="no">No</td>
As for the image, you don't seem to have included the code pertaining to it. If you could provide the code in context around this Form so I could see how the image is being placed, it would aid in discovering why it's moving.
I am trying to populate data from a click-able div container to a text box.
All the below code is present in same file "schedule.php".
The jQuery function is:
$(document).ready(function(){
$("#listItem1").click(function(){
var selectedAddress = $("#listItem1").attr("value");
$.post("schedule.php",selectedAddress,function(selectedAddress){
addressSelect($("#listItem1").attr("value"));
});
});
});
The php code is present in the same file:
<?php
function addressSelect($selectedAddress) {
$selectedAddress=$_POST['$selectedAddress'];
//echo $selectedAddress;
if(isset($selectedAddress)) list($fromName, $fromAddress, $fromCity, $fromState, $fCountry, $fromZip, $fromPhone) = explode("$$$", $selectedAddress);
}
?>
I am not able to populate it. I tried to using $.ajax also... but not helping.. what should I do to populate the textboxes at all.
The HTML is like this:
<table CELLSPACING=0 CELLPADDING=1 border=0 width=200>
<tr><td colspan=4 height=10></td></tr>
<tr>
<td width=7></td>
<td WIDTH=180 height=35><b>Name</b><font size="-1" color="#FF0000">*</font></td>
<td colspan=2 WIDTH=220>
<input NAME="fromName" TYPE="text" id="fromName" placeholder="Sender's Name" style="width:150px;" value="<?php echo $fromName;?>" MAXLENGTH="35" autofocus onBlur="ValidateName(fromName)">
<span class="error"> <?php echo $fromNameErr;?></span>
</td>
</tr>
<tr>
<td></td>
<td height=35><b>Address</b><font size="-1" color="#FF0000">*</font></td>
<td>
<TEXTAREA NAME="fromAddress" COLS=30 ROWS=3 id="fromAddress" placeholder="Sender's Address" style="width:200px; height:130px; font-size:13px; font-family:Arial,sans-serif" onBlur="ValidateAddress(fromAddress)"></TEXTAREA>
<span class="error"> <?php echo $fromAddressErr;?></span>
</td>
<td rowspan=3 align="center"></td>
</tr>
<tr>
<td></td>
<td height=35><b>Landmark</td>
<td>
<input NAME="fromLandmark" TYPE="text" id="fromLandmark" placeholder="optional" style="width:150px" value="<?php echo $fromLandmark;?>" MAXLENGTH=45>
</td>
</tr>
<tr>
<td></td>
<td height=35><b>City</b><font size="-1" color="#FF0000">*</font></td>
<td>
<input NAME="fromCity" TYPE="text" id="fromCity" placeholder="Source City" style="width:150px" value="<?php echo $fromCity;?>" MAXLENGTH=35>
</td>
</tr>
<tr>
<td></td>
<td height=35><b>State</b><font size="-1" color="#FF0000">*</font></td>
<td colspan=2>
<input NAME="fromState" TYPE="text" id="fromState" placeholder="State of Source City" style="width:150px" value="<?php echo $fromState;?>" MAXLENGTH=25>
</td>
</tr>
<tr>
<td></td>
<td height=35><b>Zip</b><font size="-1" color="#FF0000">*</font></td>
<td colspan=2>
<input NAME="fromZip" TYPE="text" id="fromZip" placeholder="Pin Code" style="width:90px" value="<?php echo $fromZip;?>" MAXLENGTH=15 onBlur="ValidateZip(fromZip)">
<span class="error"> <?php echo $fromZipErr;?></span>
</td>
</tr>
<tr>
<td></td>
<td height=35><b>Country</b></td>
<td colspan=2>
<select NAME="fromCountry" id="fromCountry" disabled="disabled">
<?php populate_country();?>
</select></div></td>
</td>
</tr>
<tr>
<td></td>
<td height=35><b>Phone</b><font size="-1" color="#FF0000">*</font></td>
<td colspan=2>
<input NAME="fromPhone" TYPE="text" id="fromPhone" placeholder="Sender's Phone no." style="width:150px" value="<?php echo $fromPhone;?>" MAXLENGTH=15 onBlur="ValidatePhone(fromPhone)">
<span class="error"> <?php echo $fromPhoneErr;?></span>
</td>
</tr>
<tr><td colspan=4 height=10></td></tr>
</table>
<?php /*?><td style="border-right:1px solid #b2b2b2; font-size:1px; background-color: #fafafa"> </td><?php */?>
</tr>
<tr>
<td width=6 height=6></td>
<?php /*?><td height=6 style="border-bottom:1px solid #b2b2b2; font-size:1px; background-color: #fafafa"> </td><?php */?>
<td width=6 height=6></td>
</tr>
</table><!-- End of From Address container table-->
The code provided by #user2298875 has a little mistake. Change
content = $("#" + divId).innerHTML;
$("#" + textBoxId).value = content;
to
$("#" + textBoxId).val($("#" + divId).html());
I think you want to copy the data on the browser and not on the server. You can use the following JQuery code to get it done:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script language="javascript" type="text/javascript">
function copyData(divId, textBoxId) {
content = $("#" + divId).html();
$("#" + textBoxId).val(content);
}
</script>
<body>
<div id="my-div" onclick="copyData('my-div', 'my-text-box');">
This the data to be copied.
</div>
<input type="text" id="my-text-box" name="myTextBox"/>
</body>
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I'm just checking other people's works and Im fixing this design and I can't seem to have an idea on how to fix it. I don't want to change anything from the css so is it possible to just arrange it on html?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Clinical Module</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="inc/style.css" type="text/css">
</head>
<body>
<form action='' method='POST'><center>
<input type="text" placeholder="Patient Number" name="search" > <input type="submit" Value="Check" name='submit'> <br>
<?php
mysql_connect("localhost","root","");
mysql_select_db("invoices");
$search = 0;
$search=$_POST['search'];
if (isset($_POST['submit'])){
$query = "select * from `patient` where `clientid` = $search ";
$result=mysql_query($query);
while($row = mysql_fetch_array($result)){ ?>
First name:<br>
</td>
<td valign="top" align="left">
<input type="text" size="20" name="first_name" value="<?php echo $row["first_name"]?>" ></td>
<td valign="top" width="10%" rowspan="13">
</td>
</tr>
<tr>
<td valign="top" align="right">
Middle name:</td>
<td valign="top" align="left">
<input type="text" size="20" name="middle_name" value="<?php echo $row["middle_name"]?>" ></td>
</td>
</tr>
<tr>
<td valign="top" align="right">
Last Name:
</td>
<td valign="top" align="left">
<input type="text" name="last_name" size="20" value="<?php echo $row["last_name"]?>"></td>
</tr>
<tr>
<td valign="top" align="right">
Birthdate
</td>
<td valign="top" align="left">
<input type="text" name="Birthdate" size="20" value="<?php echo $row["birthdate"]; ?>"></td>
</tr>
<tr>
<td valign="top" align="right">
Age
</td>
<td valign="top" align="left">
<input readonly type="text" name="age" size="20" value="<?php echo $row["age"]?>" placeholder="YYYY-MM-DD"></td>
</tr>
<tr>
<td valign="top" align="right"> Gender:</td>
<td valign="top" align="left"><select name="gender">
<? if ($row["gender"]==Male) { ?>
<option value="Male" selected>Male</option>
<option value="Female">Female</option>
<? }else if ($row["gender"]==Female) { ?>
<option value="Male" >Male</option>
<option value="Female" selected>Female</option> <?php }?>
</select></tr>
</td><tr>
<td valign="top" align="right"> Civil Status:</td>
<td valign="top" align="left"><select name="civil_status">
<? if ($row["civil_status"]==Single) { ?>
<option value="Single" selected >Single</option>
<option value="Married">Married</option>
<option value="Separatede">Separated</option>
<option value="Widowed">Windowed</option>
<? }else if ($row["civil_status"]==Married) { ?>
<option value="Single" >Single</option>
<option value="Married" selected>Married</option>
<option value="Separated">Separated</option>
<option value="Widowed">Windowed</option>
<? }else if ($row["civil_status"]==Separated) { ?>
<option value="Single" >Single</option>
<option value="Married">Married</option>
<option value="Separated" selected>Separated</option>
<option value="Widowed">Windowed</option>
<? }else if ($row["civil_status"]==Widowed) { ?>
<option value="Single" >Single</option>
<option value="Married">Married</option>
<option value="Separated">Separated</option>
<option value="Widowed" selected>Windowed</option> <?php }?>
</select>
</td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Address:</td>
<td valign="top" align="left">
<input type="text" name="address" value="<?php echo $row["address"]?>" size="31"></td>
</tr>
<tr>
<td valign="top" align="right">
Tel. no.:</td>
<td valign="top" align="left">
<input
type="text" size="20" name="telno" placeholder="###-####" value="<?php echo $row["telno"]?>"></td></tr>
<tr>
<td valign="top" align="right">
Occupation:</td>
<td valign="top" align="left">
<input
type="text" size="20" name="occ" value="<?php echo $row["occ"]?>"></td></tr>
<tr>
<td align="right">
Spouse:</td>
<td >
<input
type="text" size="20" name="spo" value="<?php echo $row["spo"]?>"></td></tr><tr>
<td align="right">
Occupation:</td>
<td >
<input
type="text" size="20" name="occ2" value="<?php echo $row["occ2"]?>"></td></tr>
<tr>
<td align="right" width="20">
Contact Person(in case of emergency):</td>
<td >
<input
type="text" size="20" name="cp" value="<?php echo $row["cp"]?>"></td></tr><tr>
<td align="right">
Tel. no:</td>
<td >
<input
type="text" size="20" name="tel2" value="<?php echo $row["tel2"]?>"></td></tr>
<tr>
<td valign="top" align="right" nowrap>
Reffered By:</td>
<td valign="top" align="left">
<input type="text" name="reff" value="<?php echo $row["reff"]?>" size="31" ></td>
</tr>
<tr>
<td class=topHeadrow1 valign="middle" width="50%" colspan="2">
Past Medical History:</td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Allergy:</td>
<td valign="top" align="left">
<input type="text" name="all" value="<?php echo $row["all"]?>" size="31"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Previous illness:</td>
<td valign="top" align="left">
<input type="text" name="ill" value="<?php echo $row["ill"]?>" size="31"></td>
</tr>
<tr>
<td class=topHeadrow1 valign="middle" width="50%" colspan="2">
<b><font size="4">
Heredo-Familial Diseases:</font></b></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Maternal:
</td>
<td valign="top" align="left">
<input type="text" name="mat" value="<?php echo $row["mat"]?>" size="20"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Fraternal:
</td>
<td valign="top" align="left">
<input type="text" name="frat" value="<?php echo $row["frat"]?>" size="20"></td>
</tr>
<? }
}
?>
</center>
</form>
|
I'm not sure if this is what you are referring to, as you've not specified a massive amount of information...
However,
You don't seem to have the actual <table> or </table> tags on this form...
No, opening <tr> tag (as pointed out by Tim Medora Below... Thanks!)...
And also no beginning <td valign="top" align="right"> Before your First name:<br>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Clinical Module</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="inc/style.css" type="text/css">
</head>
<body>
<form action='' method='POST'><center>
<input type="text" placeholder="Patient Number" name="search" > <input type="submit" Value="Check" name='submit'> <br>
<table>
<?php
mysql_connect("localhost","root","");
mysql_select_db("invoices");
$search = 0;
$search=$_POST['search'];
if (isset($_POST['submit'])){
$query = "select * from `patient` where `clientid` = $search ";
$result=mysql_query($query);
while($row = mysql_fetch_array($result)){ ?>
<tr>
<td valign="top" align="right">
First name:<br>
</td>
<td valign="top" align="left">
<input type="text" size="20" name="first_name" value="<?php echo $row["first_name"]?>" ></td>
<td valign="top" width="10%" rowspan="13">
</td>
</tr>
<tr>
<td valign="top" align="right">
Middle name:</td>
<td valign="top" align="left">
<input type="text" size="20" name="middle_name" value="<?php echo $row["middle_name"]?>" ></td>
</td>
</tr>
<tr>
<td valign="top" align="right">
Last Name:
</td>
<td valign="top" align="left">
<input type="text" name="last_name" size="20" value="<?php echo $row["last_name"]?>"></td>
</tr>
<tr>
<td valign="top" align="right">
Birthdate
</td>
<td valign="top" align="left">
<input type="text" name="Birthdate" size="20" value="<?php echo $row["birthdate"]; ?>"></td>
</tr>
<tr>
<td valign="top" align="right">
Age
</td>
<td valign="top" align="left">
<input readonly type="text" name="age" size="20" value="<?php echo $row["age"]?>" placeholder="YYYY-MM-DD"></td>
</tr>
<tr>
<td valign="top" align="right"> Gender:</td>
<td valign="top" align="left"><select name="gender">
<? if ($row["gender"]==Male) { ?>
<option value="Male" selected>Male</option>
<option value="Female">Female</option>
<? }else if ($row["gender"]==Female) { ?>
<option value="Male" >Male</option>
<option value="Female" selected>Female</option> <?php }?>
</select></tr>
</td><tr>
<td valign="top" align="right"> Civil Status:</td>
<td valign="top" align="left"><select name="civil_status">
<? if ($row["civil_status"]==Single) { ?>
<option value="Single" selected >Single</option>
<option value="Married">Married</option>
<option value="Separatede">Separated</option>
<option value="Widowed">Windowed</option>
<? }else if ($row["civil_status"]==Married) { ?>
<option value="Single" >Single</option>
<option value="Married" selected>Married</option>
<option value="Separated">Separated</option>
<option value="Widowed">Windowed</option>
<? }else if ($row["civil_status"]==Separated) { ?>
<option value="Single" >Single</option>
<option value="Married">Married</option>
<option value="Separated" selected>Separated</option>
<option value="Widowed">Windowed</option>
<? }else if ($row["civil_status"]==Widowed) { ?>
<option value="Single" >Single</option>
<option value="Married">Married</option>
<option value="Separated">Separated</option>
<option value="Widowed" selected>Windowed</option> <?php }?>
</select>
</td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Address:</td>
<td valign="top" align="left">
<input type="text" name="address" value="<?php echo $row["address"]?>" size="31"></td>
</tr>
<tr>
<td valign="top" align="right">
Tel. no.:</td>
<td valign="top" align="left">
<input
type="text" size="20" name="telno" placeholder="###-####" value="<?php echo $row["telno"]?>"></td></tr>
<tr>
<td valign="top" align="right">
Occupation:</td>
<td valign="top" align="left">
<input
type="text" size="20" name="occ" value="<?php echo $row["occ"]?>"></td></tr>
<tr>
<td align="right">
Spouse:</td>
<td >
<input
type="text" size="20" name="spo" value="<?php echo $row["spo"]?>"></td></tr><tr>
<td align="right">
Occupation:</td>
<td >
<input
type="text" size="20" name="occ2" value="<?php echo $row["occ2"]?>"></td></tr>
<tr>
<td align="right" width="20">
Contact Person(in case of emergency):</td>
<td >
<input
type="text" size="20" name="cp" value="<?php echo $row["cp"]?>"></td></tr><tr>
<td align="right">
Tel. no:</td>
<td >
<input
type="text" size="20" name="tel2" value="<?php echo $row["tel2"]?>"></td></tr>
<tr>
<td valign="top" align="right" nowrap>
Reffered By:</td>
<td valign="top" align="left">
<input type="text" name="reff" value="<?php echo $row["reff"]?>" size="31" ></td>
</tr>
<tr>
<td class=topHeadrow1 valign="middle" width="50%" colspan="2">
Past Medical History:</td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Allergy:</td>
<td valign="top" align="left">
<input type="text" name="all" value="<?php echo $row["all"]?>" size="31"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Previous illness:</td>
<td valign="top" align="left">
<input type="text" name="ill" value="<?php echo $row["ill"]?>" size="31"></td>
</tr>
<tr>
<td class=topHeadrow1 valign="middle" width="50%" colspan="2">
<b><font size="4">
Heredo-Familial Diseases:</font></b></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Maternal:
</td>
<td valign="top" align="left">
<input type="text" name="mat" value="<?php echo $row["mat"]?>" size="20"></td>
</tr>
<tr>
<td valign="top" align="right" nowrap>
Fraternal:
</td>
<td valign="top" align="left">
<input type="text" name="frat" value="<?php echo $row["frat"]?>" size="20"></td>
</tr>
<? }
}
?>
</table>
</center>
</form>
I have a form inside an html table.
I am dynamically adding input fields to a form through jquery. When I took var dump while submitting the form, the $_POST array does not have the added fields. Why is it happening?
Here is how my js looks like:
$('#add-more-del-areas').live('click',function(e){
var del_area_count = $('[name=number_of_delivery_areas]').val();
var new_count = (parseInt(del_area_count)+1);
var tr_html = '<tr>'+
'<td style="padding:10px 0px 0px 10px;"><strong>Delivery Area '+new_count+'</strong></td>'+
'<td>'+
'<input name="d_area'+new_count+'" type="text" size="50" value=""/>'+
'<div class="area-display-container" id="test'+new_count+'-display"></div>'+
'<div>'+
'<input class="auto-suggest-input" type="text" autocomplete="off" id="test'+new_count+'"/>'+
'<div class="test-content" id="test'+new_count+'-content"></div>'+
'</div>'+
'</td>'+
'</tr>'+
'<tr id="del_area-'+new_count+'" bgcolor="#FF9933">'+
'<td style="padding:10px 0px 0px 10px;"><strong>Dilivery charges for area '+new_count+'</strong></td>'+
'<td><input name="m_order'+new_count+'" type="text" size="50" value="0"></td>'+
'</tr>';
//$('#del_area-'+del_area_count).after(tr_html);
$(tr_html).insertAfter('#del_area-'+del_area_count);
big_cms.auto_suggest_({id: 'test'+new_count,input_field: 'd_area'+new_count});
$('[name=number_of_delivery_areas]').val(new_count);
e.preventDefault();
});
Though html is pathetic and too long still, here it is:
<table width="840" border="0" cellpadding="0" cellspacing="0" style="border: #57414D 4px Solid; margin:auto;">
<tr>
<td height="20px" bgcolor="#57414D" align="center" colspan="2"><span style="font-family:arial; font-size:13px; color:#ffffff"><b>You can add/edit Restaurant/Management content here!!</b></span></td>
</tr>
<?php
if ($bgclass == "bgExtraLightGray")
$bgclass = "bgWhite";
else
$bgclass = "bgExtraLightGray";
?>
<form name="frmCatPopup" method="POST" enctype="multipart/form-data" onSubmit="return ValidateContactForm();">
<tr align="center" bgcolor="#FF9933" class="<?php echo($bgclass); ?>">
<td colspan="2" class="note"> <?php echo($errMsg); ?></td>
</tr>
<tr>
<td width="40%" class="heading1" style="padding-left:10px"><strong>Register Name</strong></td>
<td width="60%" style="padding-bottom:4px;"><select name="name" class="restar_txtbox" style="width:326px;">
<?php
$quer_l="select * from ".$tableprefix."restaurant_sign_up";
$cmd_l=mysql_query($quer_l);
while($res_l=mysql_fetch_array($cmd_l))
{
?>
<option value="<?php echo $res_l['fld_id']; ?>" <?php if($rs['signup_id']==$res_l['fld_id']) echo"selected";?>><?php echo $res_l['fld_contact_person']; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr bgcolor="#FF9933">
<td width="40%" class="heading1" style="padding-left:10px"><strong>Restaurant Name</strong></td>
<td><input type="text" name="rest_name" size="50" value="<?php echo $rs['fld_name'];?>"/></td>
</tr>
<tr>
<td class="heading1" style="padding:4px 0 4px 10px;"><strong>Address</strong></td>
<td style="padding:4px 0 4px 0;">
<textarea rows="3" cols="38" name="address" id="address" value="<?php echo($rs["fld_address"]); ?>" size="50">
<?php echo($rs["fld_address"]); ?>
</textarea>
</td>
</tr>
<tr bgcolor="#FF9933">
<td class="heading1" style="padding-left:10px"><strong>Location</strong></td>
<td>
<select name="loc" style="width:326px;" ><!--onchange="locat(this.value)"-->
<option>Select Location</option>
<?php
$quer_l="select * from ".$tableprefix."location where location_status='1'";
$cmd_l=mysql_query($quer_l);
while($res_l=mysql_fetch_array($cmd_l))
{
?>
<option value="<?php echo $res_l['location_id']; ?>" <?php if($rs['location_id']==$res_l['location_id']) echo"selected";?>><?php echo $res_l['name']; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td style="padding:4px 0 4px 10px;"><strong>Area</strong></td>
<td style="padding:4px 0 4px 0;">
<?php /*?><div id="area"><select name="area" style="width:326px;">
<option value="asap">Select Location First</option>
</select>
</div><?php */?>
<select name="area" style="width:326px;">
<?php
$quer_a="select * from ".$tableprefix."area where status='1'";
$cmd_a=mysql_query($quer_a);
while($res_a=mysql_fetch_array($cmd_a))
{
?>
<option value="<?php echo $res_a['area_id']; ?>" <?php if($rs['area_id']==$res_a['area_id']) echo"selected";?>><?php echo $res_a['area_name']; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr bgcolor="#FF9933">
<td style="padding-left:10px"><strong>Opening Time</strong></td>
<td><input name="openingtime_start" type="text" id="openingtime_start" value="
<?php
$q1=$rs["fld_openingtime_start"];
$q=strlen($rs["fld_openingtime_start"]);
$S=substr("$q1","-$q","-2");
$S4=substr("$q1","-2","2");
echo $S;
?>">
<select name="start">
<option value="am" <?php if($S4=="am"){echo "selected";}?>>am</option>
<option value="pm" <?php if($S4=="pm"){echo "selected";}?>>pm</option>
</select>
</td>
</tr>
<tr>
<td style="padding:4px 0 4px 10px;"><strong>Closing Time</strong></td>
<td style="padding:4px 0 4px 0;">
<input name="closingtime_start" type="text" class="restar_txtbox" id="closingtime_start" value="
<?php
$q6=$rs["fld_closingtime_start"];
$q7=strlen($rs["fld_closingtime_start"]);
$S3=substr("$q6","-$q7","-2");
$S4=substr("$q6","-2","2");
echo $S3;
?>">
<select name="end">
<option value="am"<?php if($S4=="am"){echo "selected";}?>>am</option>
<option value="pm" <?php if($S4=="pm"){echo "selected";}?>>pm</option>
</select>
</td>
</tr>
<tr bgcolor="#FF9933">
<td style="padding:4px 0 4px 10px;"><strong>Opening Time</strong></td>
<td style="padding:4px 0 4px 0;">
<input name="openingtime_start1" type="text" class="restar_txtbox" id="openingtime_start1" value="
<?php
$q4=$rs["fld_openingtime_start1"];
$q5=strlen($rs["fld_openingtime_start1"]);
$S2=substr("$q4","-$q5","-2");
$S4=substr("$q4","-2","2");
echo $S2;
?>">
<select name="start1">
<option value="am" <?php if($S4=="am"){echo "selected";}?>>am</option>
<option value="pm" <?php if($S4=="pm"){echo "selected";}?>>pm</option>
</select>
</td>
</tr>
<tr>
<td style="padding:4px 0 4px 10px;"><strong>Closing Time</strong></td>
<td style="padding:4px 0 4px 0;">
<input name="closingtime_start1" type="text" class="restar_txtbox" id="closingtime_start1" value="
<?php
$q2=$rs["fld_closingtime_start1"];
$q3=strlen($rs["fld_closingtime_start1"]);
$S1=substr("$q2","-$q3","-2");
$S4=substr("$q4","-2","2");
echo $S1;
?>">
<select name="end1">
<option value="am" <?php if($S4=="am"){echo "selected";}?>>am</option>
<option value="pm" <?php if($S4=="pm"){echo "selected";}?>>pm</option>
</select>
</td>
</tr>
<tr bgcolor="#FF9933">
<td style="padding-left:10px"><strong>Delivery Fee</strong></td>
<td>
<input type="text" name="delivery_fee" value="<?php echo($rs["fld_deliveryfee"]); ?>" size="50">
</td>
</tr>
<tr>
<td style="padding:4px 0 4px 10px;"><strong>Cuisines</strong></td>
<td style="padding:4px 0 4px 0;">
<select name="cuisines[]" id="cuisines[]" style="width:326px;" multiple="multiple">
<?php
$quer_l="select * from ".$tableprefix."cuisines where status='1'";
$cmd_l=mysql_query($quer_l);
$allCuisines = array();
while($row = mysql_fetch_assoc($cmd_l))
{
$allCuisines[] = $row;
}
//[BIG-3] In case there are multiple cuisines selected, they were not being pulled back from DB for display at frontend.
$cuisineIds = explode(',',$rs['fld_cuisines']); // In the $cuisineIds, all the cuisines selected from DB get stored
foreach( $allCuisines as $res_l) //Looping on all cuisines as they all need to be echoed once, as well as comparing the condition for a match to the Cuisines originally associated with restaurant
{
?>
<option value="<?php echo $res_l['cuisines_id']; ?>"
<?php
foreach ( $cuisineIds as $cuisId )
{
if($cuisId ==$res_l['cuisines_id'])
echo"selected";
}
?> >
<?php echo $res_l['cuisines_name']; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td style="padding-left:10px"><strong>Pure Veg</strong></td>
<td>
<input type="checkbox" name="veg_flag"
<?php
if(isSet($rs["veg_flag"]) && $rs['veg_flag']==1)
echo("checked='checked'");
?> value="1"/>
</td>
</tr>
<!--</td> </tr> -->
<tr bgcolor="#FF9933">
<td style="padding-left:10px"><strong>Min Order</strong></td>
<td>
<input type="text" name="min_order" value="
<?php echo($rs["fld_minorder"]); ?>" size="50"/>
</td>
</tr>
<tr>
<td style="padding:4px 0 4px 10px;"><strong>Phone</strong></td>
<td style="padding:4px 0 4px 0;"><input name="phone" type="text" id="phone" size="50" value="<?php echo($rs["fld_phone"]); ?>"></td>
</tr>
<tr bgcolor="#FF9933">
<td style="padding-left:10px"><strong>Upload 1</strong></td>
<td><input name="photos" type="file" size="38" id="photos" /></td>
</tr>
<tr>
<td style="padding:4px 0 4px 10px;"><strong>upload 2</strong></td>
<td style="padding:4px 0 4px 0;"><input name="videos" type="file" id="videos" /></td>
</tr>
<tr bgcolor="#FF9933">
<td style="padding-left:10px"><strong>Rating</strong></td>
<td><input name="rating" type="text" id="rating" value="<?php echo($rs["fld_rating"]); ?>" size="50"></td>
</tr>
<!--</td></tr> -->
<tr bgcolor="#fff001">
<td class="heading1" style="padding-left:10px"><strong>Restaurent Close Day</strong></td>
<td>
<select name="day" style="width:200px;" ><!--onchange="locat(this.value)"-->
<option value="0">Select Day</option>
<option value="1">Monday</option>
<option value="2">Tuesday</option>
<option value="3">Wednesday</option>
<option value="4">Thursday</option>
<option value="5">Friday</option>
<option value="6">Saturday</option>
<option value="7">Sunday</option>
</select>
</td>
</tr>
<tr>
<td style="padding:4px 0 4px 10px;"><strong>Description</strong></td>
<td style="padding:4px 0 4px 0;"><textarea name="desc" type="text" id="desc" cols="38" rows="3" ><?php echo($rs["fld_desc"]); ?></textarea></td>
</tr>
<tr bgcolor="#FF9933">
<td style="padding-left:10px"><strong>Info</strong></td>
<td><textarea name="info" type="text" id="info" cols="38" rows="3" > <?php echo($rs["fld_info"]); ?></textarea></td>
</tr>
<tr>
<td style="padding:4px 0 4px 10px;"><strong>Specilialities</strong></td>
<td style="padding:4px 0 4px 0;"><input type="text" name="specialities" value="<?php echo($rs['fld_specialities']) ?>" size="50" /></td>
</tr>
<tr bgcolor="#FF9933" >
<td style="padding-left:10px"><strong>Delivery Time</strong></td>
<td><input name="delivery_time" type="text" id="delivery_time" size="50" value="<?php echo($rs["fld_deliverytime"]); ?>"></td>
</tr>
<tr>
<td style="padding:10px 0px 0px 10px;"><strong>Tax</strong></td>
<td><input name="tax" type="text" id="tax" size="50" value="<?php echo($rs["fld_tax"]); ?>"></td>
</tr>
<tr bgcolor="#FF9933">
<td style="padding:10px 0px 0px 10px;"><strong>Cost For One</strong></td>
<td><input name="cost" type="text" id="cost" size="50" value="<?php echo($rs["fld_cost"]); ?>"></td>
</tr>
<tr>
<td style="padding-left:10px"><strong>Packaging Charge</strong></td>
<td><input name="p_charge" type="text" size="50" value="<?php echo($rs["p_charge"]); ?>"></td>
</tr>
<tr bgcolor="#FF9933">
<td style="padding:10px 0px 0px 10px;"><strong>Label for Tax</strong></td>
<td><input name="label_t" type="text" size="50" value="<?php echo($rs["label_t"]); ?>"></td>
</tr>
<?php
if(isset($_GET['fld']))
{
$delivery_area_data = Task::getDeliveryAreaData($_GET['fld']);
$no_of_del_areas = sizeof($delivery_area_data);
if($no_of_del_areas > 0)
{
echo '<tr><td><input type="hidden" name="number_of_delivery_areas" value="'.$no_of_del_areas.'"/></td></tr>';
for($i=1;$i<=$no_of_del_areas;$i++)
{
$min_id = $i;
$min_order = $delivery_area_data[$i]['min_order'];
$area_id_str = implode(',',$delivery_area_data[$i]['area_ids']);
$area_name_str = '';
$j = 0;
foreach($delivery_area_data[$i]['area_names'] as $name)
{
$tmp_area_id = $delivery_area_data[$i]['area_ids'][$j];
$area_name_str .= '<span class="area-label" id="test'.$min_id.'-area-'.$tmp_area_id.'">
'.$name.'
<span class="test'.$min_id.'-delete-area delete-x" id="delete-area-'.$tmp_area_id.'">X</span>
</span>';
$j++;
}
echo '<tr>
<td style="padding:10px 0px 0px 10px;"><strong>Delivery Area '.$min_id.'</strong></td>
<td>
<input name="d_area'.$min_id.'" type="text" size="50" autocomplete="off" value="'.$area_id_str.'"/>
<div class="area-display-container" id="test'.$min_id.'-display">'.$area_name_str.'</div>
<div>
<input class="auto-suggest-input" type="text" autocomplete="off" id="test'.$min_id.'"/><br/>
<div class="test-content" id="test'.$min_id.'-content"></div>
</div>
</td>
</tr>
<tr id="del_area-'.$min_id.'" bgcolor="#FF9933">
<td style="padding:10px 0px 0px 10px;"><strong>Dilivery charges for area '.$min_id.'</strong></td>
<td><input name="m_order'.$min_id.'" type="text" size="50" value="'.$min_order.'"></td>
</tr>
';
}
echo '<tr>
<td>
<button id="add-more-del-areas">Add more</button>
</td>
</tr>';
}
else
{
?>
<tr>
<td style="padding:10px 0px 0px 10px;"><strong>Delivery Area 1</strong></td>
<td>
<input name="d_area1" type="text" size="50" autocomplete="off" value=""/>
<div class="area-display-container" id="test1-display"></div>
<div>
<input class="auto-suggest-input" type="text" autocomplete="off" id="test1"/><br/>
<div class="test-content" id="test1-content"></div>
</div>
</td>
</tr>
<tr bgcolor="#FF9933">
<td style="padding:10px 0px 0px 10px;"><strong>Dilivery charges for area 1</strong></td>
<td><input name="m_order1" type="text" size="50" value=""/></td>
</tr>
<tr>
<td style="padding:10px 0px 0px 10px;"><strong>Dilivery area 2</strong></td>
<td>
<input name="d_area2" type="text" size="50" value=""/>
<div class="area-display-container" id="test2-display"></div>
<div>
<input class="auto-suggest-input" type="text" autocomplete="off" id="test2"/>
<div class="test-content" id="test2-content"></div>
</div>
</td>
</tr>
<tr bgcolor="#FF9933">
<td style="padding:10px 0px 0px 10px;"><strong>Dilivery charges for area 2</strong></td>
<td><input name="m_order2" type="text" size="50" value=""/></td>
</tr>
<tr >
<td style="padding:10px 0px 0px 10px;"><strong>Dilivery area 3</strong></td>
<td>
<input name="d_area3" type="text" size="50" value=""/>
<div class="area-display-container" id="test3-display"></div>
<div>
<input class="auto-suggest-input" type="text" autocomplete="off" id="test3"/><br/>
<div class="test-content" id="test3-content"></div>
</div>
</td>
</tr>
<tr id="del_area-3" bgcolor="#FF9933">
<td style="padding:10px 0px 0px 10px;"><strong>Dilivery charges for area 3</strong></td>
<td><input name="m_order3" type="text" size="50" value=""/></td>
</tr>
<tr>
<td>
<button id="add-more-del-areas">Add more</button>
</td>
</tr>
<?php
}
}
else
{
?>
<tr>
<td style="padding:10px 0px 0px 10px;"><strong>Delivery Area 1</strong></td>
<td>
<input name="d_area1" type="text" size="50" autocomplete="off" value=""/>
<div class="area-display-container" id="test1-display"></div>
<div>
<input class="auto-suggest-input" type="text" autocomplete="off" id="test1"/><br/>
<div class="test-content" id="test1-content"></div>
</div>
</td>
</tr>
<tr bgcolor="#FF9933">
<td style="padding:10px 0px 0px 10px;"><strong>Dilivery charges for area 1</strong></td>
<td><input name="m_order1" type="text" size="50" value="<?php //echo($rs["m_order1"]); ?>"></td>
</tr>
<tr>
<td style="padding:10px 0px 0px 10px;"><strong>Dilivery area 2</strong></td>
<td>
<input name="d_area2" type="text" size="50" value=""/>
<div class="area-display-container" id="test2-display"></div>
<div>
<input class="auto-suggest-input" type="text" autocomplete="off" id="test2"/>
<div class="test-content" id="test2-content"></div>
</div>
</td>
</tr>
<tr bgcolor="#FF9933">
<td style="padding:10px 0px 0px 10px;"><strong>Dilivery charges for area 2</strong></td>
<td><input name="m_order2" type="text" size="50" value="<?php //echo($rs["m_order2"]); ?>"></td>
</tr>
<tr >
<td style="padding:10px 0px 0px 10px;"><strong>Dilivery area 3</strong></td>
<td>
<input name="d_area3" type="text" size="50" value=""/>
<div class="area-display-container" id="test3-display"></div>
<div>
<input class="auto-suggest-input" type="text" autocomplete="off" id="test3"/><br/>
<div class="test-content" id="test3-content"></div>
</div>
</td>
</tr>
<tr id="del_area-3" bgcolor="#FF9933">
<td style="padding:10px 0px 0px 10px;"><strong>Dilivery charges for area 3</strong></td>
<td><input name="m_order3" type="text" size="50" value="<?php //echo($rs["m_order3"]); ?>"></td>
</tr>
<tr>
<td>
<button id="add-more-del-areas">Add more</button>
</td>
</tr>
<?php
}
?>
<tr>
<td colspan="9" align="center" style="padding-top:5px">
<input type="submit" value="Save" name="btnSave" />
<input type="button" value="cancel">
</td>
</tr>
</form>
</table>
<div class="clr"></div>
</div>
</div>
<div class="restar_bottom"></div>
</div>
<script type="text/javascript" src="../js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="cms.js"></script>
</body>
</html>
The HTML is invalid.
You cannot have a form inside a <table> but outside a <td> or <th> that is part of that table.
Some browsers error correct by moving the form somewhere it is valid (while leaving all the controls behind).
Use a validator to find this sort of markup error.