I am creating android app of my website.I want to know which changes are necessary to make in my php files in order to connect my android app to my website's database as these files have no echo statement or I have to make another php files for these purpose.Please help as I am new to android.My first file is login.php
<?php require_once('Connection/cnn.php'); ?>
<?php
session_start();
if((isset($_POST['admin_login'])) && ($_POST['admin_login']=="form99"))
{
$_SESSION['username']=$_POST['txt_email'];
$_SESSION['password']=$_POST['txt_password'];
header('Location: login-pass.php');
}
if($_SESSION['verified']=='Y')
{
header('Location: transporter-account.php');
}
?>
<!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=utf-8" />
<title>Transporteazy</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/main.js"></script>
</head>
<body>
<!-- MAIN BODY WRAPPER START -->
<div id="main-Body-Wrapper">
<!-- HEADER PART START -->
<div id="header-con">
<?php include ('header.php'); ?>
</div>
<!-- HEADER PART END -->
<!-- MIDDLE PART START -->
<div class="how-it-work">
<div class="left-part">
<?php if($_GET['msg']=='error') {?>
<h1>Please login below to see posted loads or click here to register with us.</h1>
<?php } else {?>
<h1>Login Area</h1>
<?php } ?>
<div class="login">
<?php $page=$_SERVER['QUERY_STRING'];
if ($page!="") { ?>
<div class="error">
<?php if ($_GET['error']=="empty") { ?>
<p class="alert">Please enter user name & password.</p>
<?php } else if ($_GET['error']=="name") {?>
<p class="alert">Please enter user name.</p>
<?php } else if ($_GET['error']=="pass") {?>
<p class="alert">Please enter password.</p>
<?php } else if ($_GET['error']=="nouser") {?>
<p class="alert">Something is wrong.</p>
<?php } else if ($_GET['error']=="pend") {?>
<p class="alert">You are not a authorize person to access further pages.</p>
<?php }?>
</div>
<?php }?>
<h3>If you are already registered, please login here.</h3>
<div class="loginBox">
<form name="login-form" id="login-form" method="post">
<table width="420" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="right" valign="middle">Email Address :</td>
<td align="left" valign="top"><input name="txt_email" type="email" class="input" id="txt_email" value="" required placeholder="abc#xyz.com"/></td>
</tr>
<tr>
<td align="right" valign="middle">Password:</td>
<td align="left" valign="top"><input name="txt_password" type="password" class="input" id="txt_password" value="" required placeholder="*********"/></td>
</tr>
<tr>
<td align="right" valign="middle"> </td>
<td align="left" valign="top"><input name="Submit" type="submit" class="loginBtn" value="" />
<input type="hidden" name="admin_login" value="form99"/></td>
</tr>
<tr>
<td align="right" valign="top"> </td>
<td align="left" valign="top"> </td>
</tr>
<tr>
<td align="right" valign="top"> </td>
<td align="left" valign="top">Forgot Password? <font color="#FF0000">|</font> Register here</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<!-- RIGHT PART -->
<div class="right-part">
<?php include('benefits.php');?>
</div>
<!-- RIGHT PART -->
</div>
<!-- MIDDLE PART END -->
<!-- FOOTER PART STRAT -->
<div class="footerCon">
<?php include ('footer.php'); ?>
</div>
<!-- FOOTER PART END -->
</div>
<!-- MAIN BODY WRAPPER END -->
</body>
</html>
Related
I want to update record in php using GET method but whenever i click on "update button" it does not change anything and just refresh the page.and data remains the same.Here are the codes. Kindly tell me where i m doing it wrong. Thanks
<?php
include_once"dbconfig.php";
if(isset($_GET['edit']))
{
$id=$_GET['edit'];
echo $id;
$sql_query="SELECT * FROM users WHERE user_id='$id' ";
$result_set=mysql_query($sql_query);
$fetched_row=mysql_fetch_array($result_set);
}
if(isset($_POST['btn-update']))
{
// variables for input data
$first_name=$_POST['first_name'];
$last_name=$_POST['last_name'];
$city_name=$_POST['city_name'];
//sql query to update into database
$sql_query="UPDATE users SET first_name='$first_name',last_name='$last_name',user_city='$city_name' WHERE user_id='$id' ";
mysql_query($sql_query);
//if(!$sql_query)
//die('data can not update'.mysql_error());
//else
//echo 'data updated successfully';
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<center>
<form method="post">
<table align="center">
<tr>
<td><input type="text" name="first_name" placeholder="First Name" value="<?php echo $fetched_row['first_name']; ?>"required /> </td>
</tr>
<tr>
<td><input type="text" name="last_name" placeholder="Last Name" value="<?php echo $fetched_row['last_name']; ?>" required /> </td>
</tr>
<tr>
<td><input type="text" name="city_name" placeholder="City" value="<?php echo $fetched_row['user_city']; ?>" required /> </td>
</tr>
<tr>
<td>
<button type="submit" name="btn-update"><strong>UPDATE</strong></button>
</td>
</tr>
</table>
</form>
</center>
</body>
</html>
Second File
<?php
include_once"dbconfig.php";
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>CRUD Operations With php and MySql </title>
<link rel="stylesheet" href="style.css" type="text/css"/>
</head>
<body>
<center>
<div id="body">
<div id="content">
<table align="center">
<table align="center">
<tr>
<th colspan="9">Add data Here ! </th>
</tr>
<tr>
<th colspan="2">FirstName </th>
<th colspan="8">LastName</th>
<th colspan="4">CityName </th>
<th>Operations</th>
<!--<th colspan="2">Operations</th> -->
</tr>
<?php
$sql_query="SELECT * FROM users";
$result_set=mysql_query($sql_query);
while($row=mysql_fetch_row($result_set))
{
?>
<tr>
<td><?php echo $row[0]; ?> </td>
<td colspan="4"><?php echo $row[1]; ?></td>
<td colspan="6"><?php echo $row[2];?></td>
<td colspan="4"><?php echo $row[3];?></td>
<td> <a href='edit_data.php?edit=$row[0]'>EDIT</a> </td>
<!--<td align="center"><a href="javascript edt_id('<//?php echo $row[0]; ?><img src="b_edit.png" align="EDIT" /></a></td>
<td align="center"><a href="javascript:delete_id('<//?php echo $row[0];?><img src="b_drop.png" align="DELETE" /></a></td>
</tr> -->
<?php
}
?>
</table>
</div>
</div>
</center>
</body>
</html>
Change
mysql_query($sql_query);
To
mysql_query($sql_query) or die (mysql_error()) ;
You're not sending the id (the form action property is missing
I have the following view to List all products, and in that you can delete or edit a particular product, onclick of delete or edit it will call the controller,
<?php
$this->load->helper('url');
?>
<!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=utf-8" />
<title>diluks eCommerce - Home</title>
<link href="<?php
echo base_url();
?>Public/scripts/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form action="<?php echo base_url();?>index.php/productlist_controller" method="post">
<div class="container">
<?php
include 'header-adminpanel.php';
?>
<div class="level3 clearfix">
<?php
include 'product-sidebar.php';
?>
<div class="body-content">
<div class="items">
<h2>Product List</h2>
<table class="CSSTable" cellspacing="0px" cellpadding="0px">
<tr>
<td>Item Code</td><td>Item Name</td><td>Item Price</td><td>Edit</td><td>Delete</td>
</tr>
<?php foreach($products as $row): ?>
<form method="POST" action="<?php echo base_url();?>index.php/productlist_controller">
<tr>
<td><?php echo $row->itemcode; ?></td><td><?php echo $row->itemname; ?></td><td>$<?php echo $row->itemprice; ?></td><td><center><button name="btn_edit" class="link-button" value="<?php echo $row->itemcode; ?>" type="submit">Edit</button></center></td><td><center><button name="btn_delete" class="link-button" value="<?php echo $row->itemcode; ?>" type="submit">Delete</button></center></td>
</tr>
</form>
<?php endforeach ?>
</table>
</div>
</div>
</div>
<div style="clear:both"></div>
<div class="level4">
<div class="footer-area">
<div class="lined-space"></div>
<div class="site-map" align="left">
<table>
<tr>
<td class="footer-text">About Us</td>
<td class="footer-text">Facebook</td>
</tr>
<tr>
<td class="footer-text">Contact Us</td>
<td class="footer-text">Twitter</td>
</tr>
<tr>
<td class="footer-text">FAQs</td>
<td class="footer-text">Terms & Conditions</td>
</tr>
<tr>
<td class="footer-text">Help</td>
</tr>
</table>
</div>
<div class="developer-info">
<a class="developers-text">Designed & Developed By Diluks Software Solutions.</a>
</div>
</div>
</div>
</div>
</form>
</body>
</html>
So the controller to the above view look like belo
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Productlist_controller extends CI_Controller {
function __construct(){
parent::__construct();
}
public function index()
{
if(isset($_POST["btn_delete"])){
$pid = $_POST["btn_delete"];
$this->load->model('product_model');
$result = $this->product_model->deleteProduct($pid);
if($result==true){
$data = array();
$this->load->model('product_model');
$data['products'] = $this->product_model->availableProductList();
$this->load->view('admin_product_list_view',$data);
}
else{
echo "Oops! Error occured..!";
}
}
else if(isset($_POST["btn_edit"])){
$pid = $_POST["btn_edit"];
$data = array();
$this->load->model('product_model');
$data['product'] = $this->product_model->readProduct($pid);
//$this->load->model('category_model');
//$data['categories'] = $this->category_model->getCategories();
$this->load->view('admin_product_edit_view', $data);
}
}
}
"admin_product_edit_view" which the user will be redirected onclick of edit for an particular item is as follows,
<?php
$this->load->helper('url');
?>
<!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=utf-8" />
<title>diluks eCommerce - Home</title>
<link href="<?php
echo base_url();
?>Public/scripts/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form enctype="multipart/form-data" action="<?php
echo base_url();
?>index.php/addproduct_controller" method="post">
<div class="container">
<?php
include 'header-adminpanel.php';
?>
<div class="level3 clearfix">
<?php
include 'product-sidebar.php';
?>
<div class="body-content">
<div class="items">
<h2>Edit Product</h2>
<?php foreach($product as $row){ ?>
<table>
<tr>
<td class="captions">Product Code</td>
<td><input name="txt_pcode" type="text" readonly="true" value="<?php echo $row->itemcode; ?>"/></td>
</tr>
<tr>
<td class="captions">Product Name</td>
<td><input name="txt_pname" type="text" size="40" value="<?php echo $row->itemname; ?>" /></td>
</tr>
<tr>
<td class="captions">Product Price</td>
<td><input name="txt_pprice" type="text" value="<?php echo $row->itemprice; ?>" /></td>
</tr>
<tr>
<td class="captions">Product Category</td>
<td><select name="txt_pcategory">
<?php
foreach($categories as $row)
{
echo '<option value="'.$row->catname.'">'.$row->catname.'</option>';
}
?>
</select></td>
</tr>
<tr>
<td class="captions">Product Description</td>
<td><textarea name="txt_pdesc" style="width:300px;height:100px;"><?php echo $row->itemdesc; ?></textarea></td>
</tr>
<tr>
<td class="captions">Product Image</td>
<td><input type="file" name="userfile" size="20" /></td>
</tr>
<tr>
<td class="captions">Product Options</td>
<td><input name="txt_poptions" size="40" type="text" /><a class="hint"> (Separate by a "," comma)</a></td>
</tr>
<tr><td><input name="btn_add" class="grey-button" type="submit" value="Update" /></td></tr>
</table>
<?php } ?>
<br />
</div>
</div>
</div>
<div style="clear:both"></div>
<div class="level4">
<div class="footer-area">
<div class="lined-space"></div>
<div class="site-map" align="left">
<table>
<tr>
<td class="footer-text">About Us</td>
<td class="footer-text">Facebook</td>
</tr>
<tr>
<td class="footer-text">Contact Us</td>
<td class="footer-text">Twitter</td>
</tr>
<tr>
<td class="footer-text">FAQs</td>
<td class="footer-text">Terms & Conditions</td>
</tr>
<tr>
<td class="footer-text">Help</td>
</tr>
</table>
</div>
<div class="developer-info">
<a class="developers-text">Designed & Developed By Diluks Software Solutions.</a>
</div>
</div>
</div>
</div>
</form>
</body>
</html>
Now the problem is in the controller i need to load up categories (which I have commented) in order to show them in the edit view, but when I un-commented it, categories are loading, but Gives an Error in Item Description textarea saying
Message: Undefined property: stdClass::$itemdesc
With the category model loading line commented, it works fine except no categories will load up in the dropdownlist,Please someone suggest me a way to get rid of this.
Please use this in your view
if(isset($row->itemdesc)) echo $row->itemdesc;
I think this will solve your problem
I saw that you got an answer but i have a few suggestions for your code:
1. in your controller you load the model 3 times: you should load it once; you could do something like this:
if(!empty($_POST)){
$this->load->model('product_model');
if(isset($_POST["btn_delete"])){
//some code
}elseif(isset($_POST["btn_edit"])){
//some other code
}
}
2. in your views you load a helper: this should be loaded into the controller, right after the first verification from point 1.
3. in views you should check your variable for content, especially the ones that you are going to use in a loop, like $products
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
i want to send id by ajax while selecting respective dropdown. my code is here. here i have dropdown for all row and when i choose any dropdown id of that particular row will go but here only first row's id goes everytime.
<?php
include('adodb/adodb.inc.php');
include('inc/config.php');
if(!isset($_SESSION['adminuserid']))
{
header("location:login.php");
}
$table="register";
$temp = $db->Execute("SELECT * FROM $table ORDER BY id DESC " );
$r['fname'] = $_REQUEST['fname'];
$r['email'] = $_REQUEST['email'];
$r['phone'] = $_REQUEST['phone'];
$r['picuptime'] = $_REQUEST['picuptime']. "," . $_REQUEST['mm'];
$r['picupdate'] = $_REQUEST['picupdate'];
?>
<!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=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Regular Booking| Othminicabs.co.uk</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<!--[if IE 9]>
<link rel="stylesheet" media="screen" href="css/ie9.css"/>
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" media="screen" href="css/ie8.css"/>
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" media="screen" href="css/ie7.css"/>
<![endif]-->
<script type="text/javascript" src="js/plugins/jquery-1.7.min.js"></script>
<script type="text/javascript" src="js/plugins/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="js/plugins/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="js/custom/general.js"></script>
<script type="text/javascript" src="js/custom/tables.js"></script>
<!--[if lt IE 9]>
<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
<![endif]-->
<script type="text/javascript">
jQuery(document).ready(function() {
refreshCarLocation();
myFunction();
});
function refreshCarLocation(){
jQuery.ajax({
url:"refresh.php",
success:function(response){
jQuery('#driver').html(response);
}
});
}
function myFunction()
{
setInterval(function(){
refreshCarLocation()
}
,5000);
}
</script>
<script type="text/javascript">
function action()
{
jQuery.ajax({
url: "ajax/tabledata.php?id="+jQuery('#userid').val(),
})
}
</script>
</head>
<body class="loggedin">
<?php include("inc/header.php"); ?>
<!-- START OF MAIN CONTENT -->
<div class="mainwrapper">
<div class="mainwrapperinner">
<?php include("inc/mainleft.php"); ?>
<div class="maincontent noright">
<div class="maincontentinner">
<ul class="maintabmenu">
<li class="current">Regular Booking</li>
<li>Corporate Booking</li>
<li>Personal Booking</li>
<li>Topup Booking</li>
</ul><!--maintabmenu-->
<div class="content2">
<div class="contenttitle radiusbottom0">
<h2 class="table"><span>RegularBooking Table</span></h2>
</div><!--contenttitle-->
<?php if($_GET['msg']=="update") { ?>
<div class="notification msgsuccess" id="update" style="display:block;">
<a class="close"></a>
<p>Your Changes were <strong>Successfully</strong> Done! </p>
</div>
<?php } ?>
<?php if($_GET['msg']=="mail") { ?>
<div class="notification msgsuccess" id="update" style="display:block;">
<a class="close"></a>
<p>Your Job is <strong>Successfully</strong> Dispatched! </p>
</div>
<?php } ?>
<?php if($_GET['msg']=="sorry") { ?>
<div class="notification msgerror">
<a class="close"></a>
<p style="background:#FAD5CF">Sorry Your job is not Dispatched Please select active Driver!</p>
</div>
<?php } ?>
<table cellspacing="0" cellpadding="5" class="stdtable">
<tr>
<td>
<img src="images/bluedot.png" class="imgg" /> <strong>New</strong>
</td>
<td>
<img src="images/reddot.png" class="imgg" /> <strong>Cancelled</strong>
</td>
<td>
<img src="images/yellowdot.png" class="imgg" /> <strong>Confirmed</strong>
</td>
<td>
<img src="images/browndot.jpg" class="imgg" /> <strong>Pending</strong>
</td>
<td>
<img src="images/blackdot.png" class="imgg" /> <strong>Posponed</strong>
</td>
<td>
<img src="images/greendot.png" class="imgg"/> <strong>Confirmed Operator</strong>
</td>
<td>
<img src="images/greendot.png" class="imgg"/> <strong>Confirmed Driver</strong>
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" class="stdtable" id="dyntable">
<colgroup>
<col class="con0" />
<col class="con1" />
<col class="con0" />
<col class="con1" />
<col class="con0" />
<col class="con1" />
<col class="con0" />
<col class="con1" />
<col class="con0" />
</colgroup>
<thead>
<tr>
<th class="head0">#</th>
<th class="head1">Booking From</th>
<th class="head0">Pickup Postcode</th>
<th class="head1">Phone</th>
<th class="head0">Pickup Time</th>
<th class="head1">Pickup Date</th>
<th class="head0">Status</th>
<th class="head1"> </th>
<th class="head0"> </th>
<th class="head1"> </th>
</tr>
</thead>
<tfoot>
<tr>
<th class="head0">#</th>
<th class="head1">Booking From</th>
<th class="head0">Pickup Postcode</th>
<th class="head1">Phone</th>
<th class="head0">Pickup Time</th>
<th class="head1">Pickup Date</th>
<th class="head0">Status</th>
<th class="head1"> </th>
<th class="head0"> </th>
<th class="head1"> </th>
</tr>
</tfoot>
<tbody>
<? if(count($temp)==0) { ?>
<tr>
<td colspan="14" align="center"><span style="color: red; font-weight: bold;">No records found.</span></td>
</tr>
<? } else { ?>
<? foreach($temp as $k=>$r) { ?>
<tr class="gradeX">
<td class="center"><?=$r['id']?> </td>
<td class="center"><?=$r['booking_from']?></td>
<td class="center"><?= $r['picuppostcode'] ?></td>
<td class="center"><?=$r['phone']?></td>
<td class="center"><? $time = explode(',',$r['picuptime']); ?>
<?= $time[0] ?>hrs <?= $time[1] ?> mnts</td>
<td class="center"><?=$r['picupdate']?></td>
<?php if($r['status']=="New"){?>
<td class="center" title="New" >
<img src="images/bluedot.png" alt="new" /></td>
<?php } elseif($r['status']=="Cancelled") { ?>
<td class="center" title="Cancelled">
<img src="images/reddot.png" /></td>
<?php } elseif($r['status']=="Confirmed") { ?>
<td class="center" title="Confirmed">
<img src="images/yellowdot.png" /></td>
<?php } elseif($r['status']=="Confirmed Operator") { ?>
<td class="center" title="Confirmed Operator">
<img src="images/greendot.png" /></td>
<?php } elseif($r['status']=="") { ?>
<td class="center">No status</td>
<?php } elseif($r['status']=="Posponend") { ?>
<td class="center" title="Posponend" >
<img src="images/blackdot.png" />
</td>
<?php } elseif($r['status']=="Pending") { ?>
<td class="center" title="Pending">
<img src="images/browndot.jpg" />
</td>
<?php } ?>
<td class="center">Quick View</td>
<td class="center">Show Map</td>
<td>
<select name="action" id="action">
<option value="">--Actions--</option>
<option value="quickview" onclick="action();"> Quick View </option>
<option value="showmap"> Show Map</option>
<option value="dispatchjob"> Dispatch job </option>
<input type="text" id="userid" value="<?=$r['id']?>" />
<!-- <input type="text" name="id" id="userid" value=<?php echo $_r['id'] ?> /> -->
</td>
</tr>
<? } ?>
<? } ?>
</tbody>
</table>
</div>
</div>
<div class="mainright">
<div class="mainrightinner">
<div class="widgetbox uncollapsible">
<div class="title"><h2 class="chat"><span>Online Drivers</span></h2></div>
<div class="widgetcontent padding0">
<!--<div class="chatsearch">
<input type="text" name="" value="Search" />
</div>-->
<ul class="contactlist" id="driver">
<li class="online new"><img src="images/avatar.png" alt="" /><span><?= $drv['name'] ?></span></li>
</ul>
<!--<div class="chatbottom">
+ Add Contact
</div>-->
</div><!--widgetcontent-->
</div><!--widgetbox-->
</div><!--mainrightinner-->
</div>
<?php include("inc/footer.php"); ?>
</div><!--maincontent-->
</div><!--mainwrapperinner-->
</div><!--mainwrapper-->
<!-- END OF MAIN CONTENT -->
</body>
</html>
You have some inputs with the same id="userid", but HTML id attribute means that id is unique. So, value of only one of that inputs was used. Also, id for select elements not unique too.
Try to rewrite like this:
<td>
<select class="action" name="action-<?=$k?>">
<option value="">--Actions--</option>
<option value="quickview">Quick View</option>
<option value="showmap">Show Map</option>
<option value="dispatchjob">Dispatch job</option>
</select>
<input type="text" name="iserid-<?=$k?>" id="userid-<?=$k?>" value="<?=$r['id']?>">
</td>
and after <table>, use JavaScript code to handle dropdowns:
<script type="text/javascript">
jQuery(function($) {
$('select.action').bind('change', function(evt) {
var $this = $(this);
if($this.val() == 'quickview') {
var id = $this.parent('td').find('input[type="text"]').val();
jQuery.ajax('ajax/tabledata.php', {
type: 'get',
data: {
id: id
}
});
}
});
});
</script>
You Didnt Close the SELECT
In Line 299
Your Code
<select name="action" id="action">
<option value="">--Actions--</option>
<option value="quickview" onclick="action();"> Quick View </option>
<option value="showmap"> Show Map</option>
<option value="dispatchjob"> Dispatch job </option>
<input type="text" id="userid" value="<?=$r['id']?>" />
FIX
<select name="action" id="action">
<option value="">--Actions--</option>
<option value="quickview" onclick="action();"> Quick View </option>
<option value="showmap"> Show Map</option>
<option value="dispatchjob"> Dispatch job </option>
</select>
Hi I have the following code and the browser is commenting out the php. The file is saved .php however nothing helps. I've searched this forum and nothing works.
<html>
<head>
<!--<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>-->
<title>
Golden Acres
</title>
<link href="css/mystyle.css" rel="stylesheet" type="text/css"/>
</head>
<body class="center">
<table class="main_tables">
<tr>
<td rowspan="2" >
<img class="main_logo" src="images/logo2.gif" alt="logo"/>
</td>
<td id="main_nav_menu" valign="bottom">
<table cellspacing="2" >
<tr>
<td id="slogan_home" colspan="6" valign="middle">
"delivering fresh close to your home"
</td>
</tr>
<tr id="extra_row"><td></td></tr>
<tr>
<td class="main_nav_menu" align="center">
<a class="main_nav_menu_links" href="index.html">home</a>
</td>
<td class="main_nav_menu">
<a class="main_nav_menu_links" href="about_us.html">about us</a>
</td>
<td class="main_nav_menu" >
<a class="main_nav_menu_links" href="boxes.html">boxes</a>
</td>
<td class="main_nav_menu">
<a class="main_nav_menu_links" href="shop.html">Shop</a>
</td>
<td class="main_nav_menu">
<a class="main_nav_menu_links" href="events.html">events</a>
</td>
<td class="main_nav_menu">
<a class="main_nav_menu_links" href="contact.html">Contact Us</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?php
if(isset($_POST['submit'])){
$submit = $_POST['submit'];
if(isset($_POST['register_fname'])&&($_POST['register_lname'])&&($_POST['register_uname'])&&($_POST['register_password'])){
$firstname = $_POST['register_fname'];
$lastname = $_POST['register_lname'];
$username = $_POST['register_uname'];
$password = $_POST['register_password'];
if(isset($firstname)&&isset($lastname)&&isset($username)&&isset($password)){
echo 'Isset is ok';
}
else
{
echo 'Isset is not ok';
}
}
}
?>
<form action="register.php" method="POST">
<input type="submit" name="submit">
</form>
</body>
</html>
The when I inspect element in the browser it's displayed as : <!-- php .... ?-->
Help would be appreciated.
add at the begins of the page before Html and even DOCTYPE declaration tag :
<?php include "register.php"; ?>
<!DOCTYPE html>
<html lang="en">
and move your code to this file < register.php >
then use the form like this:
<form id="" name="" method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>" role="form">
<input type="submit" name="submit" value="Send" >
</form>
i hope this will help
Sorry this was a silly mistake of mine.
i have a table named as item_request and it has twofields named as projectmanager and createddate which has the Timestamp format as 2012-09-11 17:46:25.
Now i want to call these two fields in another form which count the user entry between 2 different dates.and the date field is fetched from the timestamp.with this form i m sending the value through datetime picker having the format 10-12-2012 but the value in databse is in different format and the value i m sending is in diffferent format.how is it possible plzzz help me guys.
Here is the code for my form:
<?php
include("config.php");
ob_start();
error_reporting(0);
if(!isset($_SESSION[username]))
header("location: index.php");
if(isset($_POST[submit]))
{
$projectmanager=mysql_real_escape_string($_POST['projectmanager']);
$date=mysql_real_escape_string($_POST['date']);
$dateexp = explode("-",$date);
$date = mysql_real_escape_string($dateexp[0]."/".$dateexp[1]."/".$dateexp[2]);
$date1=mysql_real_escape_string($_POST['date1']);
$dateexp1 = explode("-",$date1);
$date1 = mysql_real_escape_string($dateexp1[0]."/".$dateexp1[1]."/".$dateexp1[2]);
echo $queryuser= "select * from item_request where projectmanager=$projectmanager AND (requireddate>=$date AND requireddate<=$date1)";
}
?>
<!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=utf-8" />
<title>Project Managers Registrarion</title>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
<script language="javascript" type="text/javascript" src="js/datetimepicker.js">
//Date Time Picker script- by TengYong Ng of http://www.rainforestnet.com
//Script featured on JavaScript Kit (http://www.javascriptkit.com)
//For this script, visit http://www.javascriptkit.com
</script>
</head>
<body>
<div class="container">
<div class="header"><img src="images/cherry-new.jpg" width="79" height="93" />
<!-- end .header --></div>
<?php include("rightMenu.php");?>
<div class="content">
<h1>PR Count</h1>
<div style="padding:10px 0px; text-align:center; color:#990000;">
</div>
<form action="" method="post" name="loginform">
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td>Project Managers</td>
<td><select name="projectmanager" style="width:145px;" id="projectmanager" onChange="showUser(this.options[this.selectedIndex].id)">
<option value="">Select</option>
<?php $queryuser= "select * from projectmanagers";
$fetuser1user = mysql_query($queryuser);
while($fetuser = mysql_fetch_array($fetuser1user)){
?>
<option id="<?php echo $fetuser['id']?>" value="<?php echo $fetuser['id']?>"><?php echo $fetuser['projectmanager']?></option>
<?php }
?>
</select></td>
</tr>
<tr>
<td>Date From</td>
<td>
<input id="date" type="text" size="20" name="date" /><img src="images/cal.gif" width="16" height="16" border="0" alt="Pick a date"></td>
</tr>
<tr>
<td>Date To</td>
<td>
<input id="date1" type="text" size="20" name="date1"><img src="images/cal.gif" width="16" height="16" border="0" alt="Pick a date"></td>
</tr>
<tr>
<td> </td>
<td>
<input type="submit" name="submit" id="submit" value="Submit" onClick="return formvalidate();"/>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<table width="100%" border="1"><tr>
<td width="18%" valign="middle" class="tableheading">PI.No.</td>
<td width="18%" valign="middle" class="tableheading">Project Manager</td>
<td width="18%" valign="middle" class="tableheading">Date Created</td>
<td width="15%" valign="middle" class="tableheading">Action</td>
</tr>
<?php
// to print the records
$select = "select * from item_request";
$query1 = mysql_query($select);
while($value = mysql_fetch_array($query1)){ ?>
<tr>
<td class="tabletext"><?php echo $value[id];?></td>
<td class="tabletext"><?php echo $value[projectmanager];?></td>
<td class="tabletext"><?php echo $value[datefrom];?></td>
<td class="tabletext"><img src="images/edit.png" width="25" height="25" border="0" title="Edit" />
<img src="images/deleteBtn.png" width="25" height="25" border="0" title="Edit" /></td>
</tr><?php }?>
</table>
</form>
<!-- end .content --></div>
<?php include("footer.php");?>
<!-- end .container --></div>
</body>
</html>
Replace this function call...
javascript:NewCal('date','ddmmyyyy');
with this one...
javascript:NewCal('date','ddmmyyyy',true,24);
Hope it helps.