nogle der kan hjælpe mig med dette script jeg kan ikke få det til at virke
<?php
include_once("header.php");
include_once("../_CALL.php");
$login_id = $_SESSION["login_id"];
$pprice = "";
$ssprice = "";
$fftime = "";
$ttTime = "";
$ffdate = "";
$ttdate = "";
$ccolor = "";
if(isset($_POST['update']))
{
$params = "";
foreach ($_POST as $key => $value) {
# code...
if($params == "")
{
$params = $key."=".$value;
}
else
{
$params .= "&". $key."=".$value;
}
}
if($params != "")
{
$params .= "&club_id=".$login_id;
}
// echo WEB_SERVICES."service.php?op=update_products",$params;
// die();
$result = call_service(WEB_SERVICES."service.php?op=update_products",$params);
if($result->success==1)
{
echo '<script> window.location.href="productview.php"; </script>';
exit(0);
}
}
//print_r();
// die();
$s_product_id=0;
if(!empty($_GET["product_id"]))
{
$s_product_id = $_GET["product_id"];
}
// echo WEB_SERVICES."service.php?op=view_products&club_id=".$login_id;
// die();
$result = call_service(WEB_SERVICES."service.php?op=view_products","club_id=".$login_id);
$obj = "";
if(array_key_exists("dictionary", $result))
{
$obj =$result->dictionary;
}
//print_r($obj);
// die();
?>
<div class="col-one-10">
<div class="top_line_tab"><span class="top_line_tab_text">Add Product</span></div>
<div class="row" style="margin-left:91px;">
<form class="form-horizontal" action="" method="POST">
<input type="hidden" name="product_id" value="<?php echo $_GET['product_id'] ?>" />
<fieldset>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="name">Fuldenavn:</label>
<div class="col-md-4">
<div>
<select class="form-control input-md" name="productid" id="productid" >
<option value="">--select Product--</option>
<?php
foreach ($obj as $key => $value) {
# code...
echo '<option value="volvo"';
if($value->product_id==$s_product_id)
{
echo 'selected="selected">';
$pprice = $value->price;
$ssprice = $value->special_price;
$ffdate = $value->product_from;
$ttdate = $value->product_to;
$ccolor = $value->btn_color;
}
else
"echo '$value->product_name; </option>"
}
?>
</select>
</div>
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="price">Price : </label>
<div class="col-md-4">
<input type="number" class="form-control input-md" name="price" id="price" placeholder="Price" value="<?php echo $pprice ?>" class="form-control input-md">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="special_price">Special inteval price: </label>
<div class="col-md-4">
<input type="number" class="form-control input-md" name="special_price" id="special_price" placeholder="special price" value="<?php echo $ssprice ?>" class="form-control input-md">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="product_from">Fra: </label>
<div class="col-md-2">
<!-- <input id="product_from" type="time" name="product_from" placeholder="tt:mm" value="<?php echo date("h:i:s A",strtotime($obj->product_from)) ?>" class="form-control input-md" type="text">
-->
<input type="text" class="timepicker" id="product_from" name="product_from" value="<?php echo date("H:i:s A",strtotime($ffdate)) ?>">
</div>
<div class="col-md-2">
<!-- <input id="from date" type="date" name="fromdate" value="<?php echo date("d M Y ",strtotime($obj->product_from)) ?>" placeholder="dd.mm.åååå" class="form-control input-md" type="text"> -->
<input type="text" class="datepicker" id="from date" name="fromdate" value="<?php echo date("d M Y ",strtotime($ffdate)) ?>">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="totime">Til: </label>
<div class="col-md-2">
<!-- <input id="product_to" type="time" name="product_to" placeholder="tt:mm" value="<?php echo date("h:i:s A",strtotime($obj->product_to)) ?>" class="form-control input-md" type="text">
-->
<input type="text" class="timepicker" id="product_to" name="product_to" value="<?php echo date("H:i:s A",strtotime($ttdate)) ?>">
</div>
<div class="col-md-2">
<!-- <input id="todate" name="todate" type="date" value="<?php echo date("d M Y ",strtotime($obj->product_to)) ?>" placeholder="dd.mm.åååå" class="form-control input-md" type="text">
-->
<input type="text" class="datepicker" id="todate" name="todate" value="<?php echo date("d M Y ",strtotime($ttdate)) ?>">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="colorid">Button Color:</label>
<div class="col-md-4">
<div>
<select class="form-control input-md" name="colorid" id="colorid">
<option value="">--select Product Color --</option>
<option value="standard" <?php if($ccolor=="standard") echo 'selected="selected"'?>>Standard Grey</option>
<!-- $ccolor -->
<option value="dark-grey" <?php if($ccolor=="dark-grey") echo 'selected="selected"'?>>Dark Grey </option>
<option value="grey-shine" <?php if($ccolor=="grey-shine") echo 'selected="selected"'?>>Grey Shine </option>
<option value="black_high" <?php if($ccolor=="black_high") echo 'selected="selected"'?>>Black High </option>
<option value="black" <?php if($ccolor=="black") echo 'selected="selected"'?>>Black </option>
<option value="blue" <?php if($ccolor=="blue") echo 'selected="selected"'?>>Blue </option>
<option value="dark-blue" <?php if($ccolor=="dark-blue") echo 'selected="selected"'?>>Dark Blue</option>
<option value="sky-blue" <?php if($ccolor=="sky-blue") echo 'selected="selected"'?>>Sky Blue</option>
<option value="copperdeep-red" <?php if($ccolor=="copperdeep-red") echo 'selected="selected"'?>>Copper Deep Red</option>
<option value="dark-red" <?php if($ccolor=="dark-red") echo 'selected="selected"'?>>Dark Red</option>
<option value="Yellow" <?php if($ccolor=="Yellow") echo 'selected="selected"'?>>Yellow </option>
<option value="copper" <?php if($ccolor=="copper") echo 'selected="selected"'?>>Copper</option>
<option value="green" <?php if($ccolor=="green") echo 'selected="selected"'?>>Green</option>
<option value="lime-green" <?php if($ccolor=="lime-green") echo 'selected="selected"'?>>Lime Green</option>
<option value="Pastel" <?php if($ccolor=="Pastel") echo 'selected="selected"'?>>Pastel</option>
<option value="rosa" <?php if($ccolor=="rosa") echo 'selected="selected"'?>>Rosa</option>
<option value="purple" <?php if($ccolor=="purple") echo 'selected="selected"'?>>Purple</option>
</select>
</div>
</div>
</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="update"></label>
<div class="col-md-4">
<button id="update" name="update" class="btn btn-primary">Update</button>
<a type="button" id="Cancel" name="Cancel" class="btn btn-danger" href="productview.php">Cancel </a>
</div>
</div>
</fieldset>
</form>
</div>
</div>
<?php
include '../footer.php';
?>
Indlæg senest redigeret d. 10.11.2015 16:33 af Bruger #16975