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
Related
I am trying to echo more than one item on an invoice for the same customer. I am able to echo them from the database, but instead of each item being echoed on the same invoice (on different rows), it echoes the full invoice 2 times (or more depending on how many items are on the invoice) with each item on each invoice. Below is my code (I have not yet cleaned the code up. I am leaving that step once the code works).
<?php include "database_connection.php" ?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>DPB quote</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex, nofollow">
<link rel="stylesheet" href="css/bootstrap.min.css"><!--erase this link once the app is completed-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel='stylesheet' type='text/css' href='css/style2.css' />
<link rel='stylesheet' type='text/css' href='css/print.css' media="print" />
<script type='text/javascript' src='js/jquery-1.3.2.min.js'></script>
<script type='text/javascript' src='js/example.js'></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css"><!--search pagination and delete reference link-->
<script type="text/javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script><!--search pagination and delete reference link-->
</head>
<body>
<?php
$statement = $connect->prepare("
SELECT * FROM tbl_order
WHERE order_id = :order_id
LIMIT 1
");
$statement->execute(
array(
':order_id' => $_GET["id"]
)
);
$result = $statement->fetchAll();
foreach($result as $row)
{
?>
<script>
$(document).ready(function(){
$('#order_no').val("<?php echo $row["order_no"]; ?>");
$('#order_date').val("<?php echo $row["order_date"]; ?>");
$('#order_receiver_name').val("<?php echo $row["order_receiver_name"]; ?>");
$('#address_line_1').val("<?php echo $row["address_line_1"]; ?>");
$('#address_line_2').val("<?php echo $row["address_line_2"]; ?>");
$('#city').val("<?php echo $row["city"]; ?>");
$('#state').val("<?php echo $row["state"]; ?>");
$('#zip_code').val("<?php echo $row["zip_code"]; ?>");
$('#phone_number').val("<?php echo $row["phone_number"]; ?>");
$('#email').val("<?php echo $row["email"]; ?>");
$('#notes').val("<?php echo $row["notes"]; ?>");
});
</script>
<form method="post" id="invoice_form">
<div class="container">
<?php
$statement = $connect->prepare("
SELECT * FROM tbl_order_item
WHERE order_id = :order_id
");
$statement->execute(
array(
':order_id' => $_GET["id"]
)
);
$item_result = $statement->fetchAll();
$m = 0;
foreach($item_result as $sub_row)
{
$m = $m + 1;
?>
<!--QUOTATION APP 2 STARTS HERE-->
<div id="page-wrap">
<textarea id="header">Quotation</textarea>
<div id="identity">
<textarea id="address">Discount Plastic Bags
7750
Suite
Irving
Phone: </textarea>
<div id="logo">
<div id="logohelp">
(max width: 540px, max height: 300px)
</div>
<img id="image" src="images/dpblogo3.png" alt="logo" />
</div>
</div>
<div style="clear:both"></div>
<div id="customer">
<!--<form id="quote_date" class="" action="index.php" method="post">-->
<tr>
<td><textarea placeholder="Enter Customer Information" id="address" name="company_info"></textarea></td>
</tr>
<table id="meta">
<tr>
<td class="meta-head">Invoice #</td>
<td><textarea>000123</textarea></td>
</tr>
<tr>
<td class="meta-head">Date</td>
<td><textarea placeholder="enter quotation date" name="quote_date"></textarea></td>
</tr>
<tr>
<td class="meta-head">Amount Due</td>
<td><textarea placeholder="enter amount due" name="amount_due"></textarea></td>
</tr>
</table>
</div>
<table id="items">
<tr>
<th>SKU</th>
<th>Description</th>
<th>Quantity</th>
<th>Unit Cost</th>
<th>Price</th>
</tr>
<tr class="item-row">
<!--<td><span id="sr_no"><?php //echo $m; ?></span></td>-->
<td><input type="text" name="sku[]" id="sku<?php echo $m; ?>" class="item-name" value="<?php echo $sub_row["sku"]; ?>" /></td>
<td><input type="text" name="item_name[]" id="item_name<?php echo $m; ?>" class="description" value="<?php echo $sub_row["item_name"]; ?>" /></td>
<td><input type="text" name="order_item_quantity[]" id="order_item_quantity<?php echo $m; ?>" data-srno="<?php echo $m; ?>" class="qty" value = "<?php echo $sub_row["order_item_quantity"]; ?>" /></td>
<td><input type="text" name="order_item_price[]" id="order_item_price<?php echo $m; ?>" data-srno="<?php echo $m; ?>" class="cost" value="<?php echo $sub_row["order_item_price"]; ?>" /></td>
<td><input type="text" name="order_item_final_amount[]" id="order_item_final_amount<?php echo $m; ?>" data-srno="<?php echo $m; ?>" readonly class="price" value="<?php echo $sub_row["order_item_final_amount"]; ?>" /></td>
</tr>
<tr>
<td colspan="2" class="blank"></td>
<td colspan="2" class="total-line">Subtotal</td>
<td class="total-value"><textarea id="subtotal" name="subtotal"></textarea></td>
</tr>
<tr>
<td colspan="2" class="blank"></td>
<td colspan="2" class="total-line">Total</td>
<td class="total-value"><textarea name="total" id="total"></textarea></td>
</tr>
<tr>
<td colspan="2" class="blank"> </td>
<td colspan="2" class="total-line">Amount Paid</td>
<td class="total-value"><textarea id="paid">$0.00</textarea></td>
</tr>
<tr>
<td colspan="2" class="blank"> </td>
<td colspan="2" class="total-line balance">Balance Due</td>
<td class="total-value balance"><textarea name="balance_due" class="due"> </textarea></td>
</tr>
</table>
<div id="terms">
<h5>Notes</h5>
<textarea name="notes" placeholder="enter quotation notes" rows="12" style="font-size: 15pt"></textarea>
</div>
</div>
</form>
</body>
</html>
<?php
}
}
?>
I would do something like this. This is not tested and just an example of how I do it. There are a few other ways but this works best for me
// other needed code above
$results = sqlsrv_query($link, $query);
//query returns one value for these
echo "<table>";
echo "<tr> ";
echo "<td>".$name."</td>";
echo "<td>".$store."</td>";
echo "</tr>";
//start your multiple items row
while($row=sqlsrv_fetch_array($results))
{
$items = $row['items'];
echo "<tr> ";
echo "<td>".$items."</td> ";
echo "</tr>";
}
echo "<tr> ";
echo "<td>".$cost."</td>";
echo "<td>".$other."</td>";
echo "</tr>";
echo "</table> ";
//other code for the rest of the page below
Result would be:
Bob Bob's Store
ITEM
ITEM
ITEM
$50.00 other
This is very quick.
I have a form that when submitted should add user input into my DB. I have had a similar form working well but for some reason this one is not working.
Please excuse my sloppy code but here is the whole page. For some reason 'observation' will not take the user input and display it on the next page (showOne.php). The next page simply shows a blank space for observation and I checked the DB and there was nothing in the observation field of course.
Is it something simple that I can't see? I've been at this for days since it is identical to another form I have that works well on another page.
Thank you for any insight.
<?php
//including the database connection file
include("config.php");
$activePage = "start.php";
if(isset($_POST['update'])) {
$id = $_POST['id'];
$observation = $_POST['observation'];
$result = mysqli_query($mysqli, "UPDATE tasks SET observation='$observation' WHERE id=$id");
header("Location: showOne.php?id=$id");
}
//getting id from url
$id = $_GET['id'];
//selecting data associated with this particular id
$result2 = mysqli_query($mysqli, "SELECT * FROM users WHERE id=$id ORDER BY id ASC");
$result = mysqli_query($mysqli, "SELECT * FROM tasks ORDER BY taskNumber ASC");
include_once "nav.php";
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Pathfinder - A User Testing Dashboard</title>
<meta name="description" content="Pathfinder - A User Testing Dashboard">
<meta name="author" content="James Stables - Thurs April 13th 2017">
<link rel="stylesheet" href="core.css">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600,700" rel="stylesheet">
<!--[if lt IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"> </script>
<![endif]-->
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
</head>
<body>
<header>
<h1 class="logo"><img src="images/logo.png">Pathfinder</h1>
<h4>User Testing Dashboard</h4>
</header>
<section class="nonav">
<div class="showAllUsers">
<table border='0'>
<tr>
<?php while($res = mysqli_fetch_array($result2))
{ ?>
<td class="widthHundred no-border left"><h2><?php echo $res['nameFirst']; ?></h2></td>
<?php } ?>
</tr>
</table>
<table border='0'>
<thead>
<tr>
<th>Image</th>
<th>Category</th>
<th>Task Number</th>
<th>Task Name</th>
<th>Observation</th>
<td> </td>
<td> </td>
<td> </td>
</tr>
</thead>
<tbody>
<form name="start" method="post" action="start.php" enctype="multipart/form-data">
<tr>
<td><a href="<?php echo $res['$image'];?>" data-lightbox="example-1" data-title="Task Number <?php echo $res['taskNumber'];?>">
<img id="imageResize" src="<?php echo $res['image'];?>" /></a></td>
<td><?php echo $res['category'];?></td>
<td><?php echo $res['taskNumber'];?></td>
<td><?php echo $res['taskName'];?></td>
<td><input type="text" name="observation" value="<?php echo $res['observation'];?>"></td>
<td> </td>
<td> </td>
<td> </td>
<?php } ?>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td><input type="hidden" name="id" value="<?php echo $_GET['id'];?>"><input type="submit" class="buttonUpdate right" name="update" value="Update"></td>
<td><a class="buttonCancel right" href="tasks.php" onClick="return confirm('Cancel and go back?')">Cancel</a></td>
</tr>
</form>
</tbody>
</table>
</div>
</section>
<script src="js/lightbox-plus-jquery.min.js"></script>
<script>
lightbox.option({
'resizeDuration': 200,
'showImageNumberLabel': false,
'fitImagesInViewport': true
})
</script>
</body>
</html>
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
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.
i have this code:
<?php
////////////////////////////////////////
include "../includes/site_includes.php";//
//////////////////////////////////////
$sql = getallsitesettings();
if ($result = $mysqli->prepare($sql))
{
$rekza = 1;
$result->bind_param("i",$rekza);
$result->execute();
$result->store_result();
$rowsZ = $result->num_rows;
}
if($rowsZ>0)
{
$row = fetch($result);
}
$siteTitle= $row[0]["site_title"];
$sitePeleText= $row[0]["pele"];
?>
<?php
$act = $mysqli->real_escape_string($_GET["act"]);
if($act=="edit")
{
$folderid = (int)$_GET["id"];
$sql2 = getfolderbyId();
if ($result2 = $mysqli->prepare($sql2))
{
$result2->bind_param("i",$folderid);
$result2->execute();
$result2->store_result();
$rowsZ2 = $result2->num_rows;
}
if($rowsZ2>0)
{
$row2 = fetch($result2);
}
for($j=0; $j<$rowsZ2; $j++)
{
$foldername = $row2[$j]["fold_name"];
$foldpath = $row2[$j]["fold_path"];
$foldpic = $row2[$j]["fold_pic"];
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html dir="rtl">
<head>
<title><?=$txt_folders?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<link href="<?=$site_url?>/css/styles.css" rel="stylesheet" type="text/css" />
</head>
<table align="center" cellspacing="0" cellpadding="0" width="1021">
<tr>
<td><?php
include "../site_header.php";
?></td>
</tr>
<tr>
<td style="background-color:#dcdbdb;">
<table align="center" cellspacing="0" cellpadding="0" width="1021">
<tr>
<td>
<div class="admintitle">
<?=$txt_main_admin?> > <?=$txt_folders?>
</div>
</td>
</tr>
<tr>
<td>
<table align="center" cellspacing="0" cellpadding="0" width="400">
<tr>
<td style="color:Black; font-family:arial; font-weight:Bold;"><?=$txt_folders_name?></td>
<td style="color:Black; font-family:arial; font-weight:normal;"><input type="textbox" name="fold_name" value="<?=$foldername?>" /></td>
</tr>
<tr>
<td style="color:Black; font-family:arial; font-weight:Bold;"><?=$txt_folder_path?></td>
<td style="color:Black; font-family:arial; font-weight:normal;"><input type="textbox" name="fold_path" value="<?=$foldpath?>" /></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><?php
include "../site_footer.php";
?></td>
</tr>
</table>
<body>
</body>
</html>
...
can you tell me whats the problem ?
why when act = add
the variables in value="" in the input is undefined?....and how can i define them in the edit and in the add...
in the add i need them empty...and in the edit it works great....
May be...
if($act=="edit" || $act=="add")
:)