I created an image url table of products and products table in database.
Registering image url and products in the database but not uploading the file.
this is php codes
$ekle = #$_POST['ekle'];
if(isset($ekle)){
$udyekle = $vt->prepare("INSERT INTO urunler(isim,
fiyat,stok,detay,katid) VALUES (?, ?, ?, ?, ?)");
$udyekle->bind_param('siisi', $_POST['urunisim'],
$_POST['urunfiyat'],
$_POST['urunstok'],
$_POST['urundetay'],
$_POST['urunkategori']);
$udyekle->execute();
$sonid = mysqli_insert_id($vt);
$udyekle->close();
$klasor="../images/product-details";
$dosya_sayi=count($_FILES['dosya']['name']);
for($i=0;$i<=$dosya_sayi;$i++){
if(!empty($_FILES['dosya']['name'][$i])){
$dosyaadi= sha1(md5($_FILES['dosya']['name'][$i]));
if(move_uploaded_file($_FILES['dosya']['tmp_name'][$i],$klasor."/".$dosyaadi)){
echo "upload successful";
}else{
echo $_FILES['dosya']['error'];
}
$resup = $vt->prepare("INSERT INTO urunresim(urunid,url) VALUES (?, ?)");
$resup->bind_param('is', $sonid,$dosyaadi);
$resup->execute();
$resup->close();
}
}
}
it gives error code 0
this is html codes.
I added the name to the submit but something did not change
<form action="urunekle.php" method="post" enctype="multipart/form-data">
<label>Ürün ismini giriniz : </label>
<input class="form-control" name="urunisim"><br>
<label>Ürün fiyatını giriniz : </label>
<input class="form-control" name="urunfiyat"><br>
<label>Ürünün stok bilgisini giriniz : </label>
<input class="form-control" name="urunstok"><br>
<label>Ürün kategorisini seçiniz : </label>
<select class="form-control" id="sel1" name="urunkategori">
<?php
$sorgucuk = mysqli_query($vt, "select * from kategoriler");
while($sonuccuk = mysqli_fetch_assoc($sorgucuk)){
?>
<option value="<?php echo $sonuccuk['id']; ?>"><?php echo $sonuccuk['isim']; ?></option>
<?php } ?>
</select><br>
<label>Ürüne resim seçiniz : </label>
<input class="form-control" type="file" name="dosya" id="dosya" multiple="multiple" />
<label>Ürün hakkında detay giriniz : </label>
<textarea class="form-control" name="urundetay"></textarea><br>
<input type="submit" name="ekle" id="ekle" value="Ekle" class="btn btn-success">
</form>
Related
I have a problem, to build INSERT PHP file with HTML form code. When I drop from HTML form, then this error pops out ""invalid input syntax for integer: "" LINE 2:""
in all code, I comment every single line and nothing.
There is my PHP script
`
$order_nr = pg_escape_string($_POST['order_nr']);
$date = pg_escape_string($_POST['date']);
$place = pg_escape_string($_POST['place']);
$service = pg_escape_string($_POST['service']);
$Vards = pg_escape_string($_POST['vards']);
$Uzvards = pg_escape_string($_POST['uzvards']);
$phone = pg_escape_string($_POST['phone']);
$email = pg_escape_string($_POST['email']);
$veids = pg_escape_string($_POST['veids']);
$passw = pg_escape_string($_POST['passw']);
$papildaprikojums = pg_escape_string($_POST['papildaprikojums']);
$save_info = pg_escape_string($_POST['save_info']);
$defekts = pg_escape_string($_POST['defekts']);
$query = " INSERT INTO serviss (order_nr, place, service, vards, uzvards, email, veids, passw, save_info, papildaprikojums, defekts)
VALUES ('$order_id', '$place', '$service', '$vards', '$uzvards', '$email', '$veids', '$passw', '$papildaprikojums', '$save_info', '$defekts') " ;
$result = pg_query($query);
if (!$result) {
$errormessage = pg_last_error();
echo "Error with query: " . $errormessage;
exit();
}
printf ("These values were inserted into the database - %s %s %s", $order_id);
pg_close();
There is my HTML form code
<form action="serviss.php" method="post" >
<div class="ievade">
Pasūtijuma numurs : <input type="text" size="5" name="order_id"> <br><br>
Pieņemšanas datums : <input type="date" data-date="" data-date-format="DD MMMM YYYY" value="2015-08-09" name="date"> <br><br>
Pieņemšanas vieta : <select name="place">
<option value="Ausekļa_iela_9"> Ausekļa iela 9 </option>
</select> <br><br>
Pieņēma : <select >
<option value="service" name="Maris"> Māris </option>
<option value="service name="Toms"> Toms </option>
</select> <br> <br>
Klienta vārds : <input type="text" name="vards" size="5"> <br><br>
Klienta uzvārds : <input type="text" name="uzvards" size="5"> <br><br>
Klienta tel.nr.: <input type="tel" id="phone" size="6"> <br><br>
Klienta e-pasts: <input type="text" value="example#test.net" name="email">
<br><br>
Iekārtas veids: <input type="text" value="iekārta" name="veids" size="5"> <br><br>
Parole: <input type="text" name="passw" size="5"> <br><br>
</div>
<div class="checkbox">
Garantija: <br>
Ir
<input type="radio" name="garantija" value="Ir"> <br>
Nav <input type="radio" name="garantija" value="Nav">
<br> <br>
</div>
<div class="ievade">
Papildaprīkojums: <input type="text" name="papildaprikojums" > <br><br>
Papildus informācija: <input type="text" name="informacija">
<br> <br>
Saglabājamā informācija: <input type="text" name="save_info">
<br> <br>
Defekta apraksts: <input type="text" name="defekts">
</div>
</div>
<input type="submit" value="Submit">
</form>
I hope you can help me.
I use PostgreSQL 10.10
It's like you have mixed up the 'order_id' with 'order_nr'.
The name value attribute is 'order_id' so when you try to get it it is
$_POST['order_id'] not `$_POST['order_nr']`
It means that either you should say
$order_nr = pg_escape_string($_POST['order_id']);
In order to use the variable into the insert statement and then
$query = " INSERT INTO serviss (order_nr, place, service, vards, uzvards, email, veids, passw, save_info, papildaprikojums, defekts)
VALUES ('$order_nr', '$place', '$service', '$vards', '$uzvards', '$email', '$veids', '$passw', '$papildaprikojums', '$save_info', '$defekts') " ;
or you shoud say
$order_id = pg_escape_string($_POST['order_id']);
And then
$query = " INSERT INTO serviss (order_nr, place, service, vards, uzvards, email, veids, passw, save_info, papildaprikojums, defekts)
VALUES ('$order_id', '$place', '$service', '$vards', '$uzvards', '$email', '$veids', '$passw', '$papildaprikojums', '$save_info', '$defekts') " ;
I am writing a portable web application with Php and I am using SQLite for my database. I want to display the date difference between two dates but it isn't working at the moment.
Can you help me, please?
(My English is not good, sorry).
My Code:
<h3>Tarihe göre arama</h3>
<form class="form-horizontal" action="" method="post">
<label>Tarih 1</label>
<input type="text" class="form-control" name="tarih1" id="tarih1" value="<?php echo $buguntarih;?>" required>
<label>Tarih 2</label>
<input type="text" class="form-control" name="tarih2" id="tarih2" value="<?php echo $buguntarih;?>" required>
<input type="submit" value="Filtrele" name="filtrele" class="btn btn-primary pull-right" style="background:none;">
</form>
<?php
if($_POST['filtrele']){
$tarih1=$_POST['tarih1'];
$tarih2=$_POST['tarih2'];
$query = $db->query("SELECT * FROM islem where eklenme_tarihi between '{$tarih1}' and '{$tarih2}' and sirket_id={$sirketid} order by id ", PDO::FETCH_ASSOC);
} else{
$query = $db->query("SELECT * FROM islem where sirket_id={$sirketid} order by id ", PDO::FETCH_ASSOC);
}
?>
<?php echo $sirket['sirket_adi']; ?></b> şirketine ait işlemler (
<?php
if($_POST['filtrele']){
echo "<b>".$tarih1."</b> ve <b>".$tarih2."</b> arası";
} else{
echo"tümü";
}
?>
(I just want a specific answer as to why this happens)
I have been learning PHP and MySQL here in StackOverflow and most of the time I get too excited and combine things that I have Learned from here so far. Though I try to understand things directly from the mistakes I make, there are still some things I am not able to solve on my own. The most recent problem is:
I have been working on an example for quite a while and I am constantly getting the below error message after clicking the "Add New Record" button.
Though I have no problems and have not received any errors when I only have 3 declared variables when I added more input tags () to my page, I start to receive these error messages and my insert query couldn't get through.
Below are the errors that show after clicking the "Add New Record" button:
Notice: Undefined index: buyprice in C:\xampp\htdocs\sppap\create.php
on line 54
Notice: Undefined index: grosssale in C:\xampp\htdocs\sppap\create.php
on line 76
and here is my PHP and relevant HTML:
PHP
<?php
require_once 'config.php';
$brand = $generic = $wgtvol = $unit = $manufacturer = "";
$buyprice = $sellprice = $grosssale = "";
$brand_err = $generic_err = $wgtvol_err = $unit_err = $manufacturer_err = $buyprice_err = $sellprice_err = $grosssale_err = "";
if($_SERVER["REQUEST_METHOD"] == "POST"){
$input_brand = trim($_POST["brand"]);
if(empty($input_brand)){
$brand_err = '<b style="color: #960303; font-size: 160%">Please enter the brand name of the product.</b>';
} else{
$brand = $input_brand;
}
$input_generic = trim($_POST["generic"]);
if(empty($input_generic)){
$generic_err = '<b style="color: #960303; font-size: 160%">Please enter the generic name of the product.</b>';
} else{
$generic = $input_generic;
}
$input_wgtvol = trim($_POST["wgtvol"]);
if(empty($input_wgtvol)){
$wgtvol_err = '<b style="color: #960303; font-size: 160%">Please enter the weight or volume of the product.</b>';
} else{
$wgtvol = $input_wgtvol;
}
$input_manufacturer = trim($_POST["manufacturer"]);
if(empty($input_manufacturer)){
$manufacturer_err = '<b style="color: #960303; font-size: 160%">Please enter the manufacturer of the product.</b>';
} else{
$manufacturer = $input_manufacturer;
}
$input_unit = trim($_POST["unit"]);
if(empty($input_unit)){
$unit_err = '<b style="color: #960303; font-size: 160%">Please choose a measurement unit of the product.</b>';
} else{
$unit = $input_unit ;
}
$input_buyprice = trim($_POST["buyprice"]);
if(empty($input_buyprice)){
$buyprice_err = '<b style="color: #960303; font-size: 160%">Please enter the buy price of the product.</b>';
} else{
$buyprice = $input_buyprice;
}
$input_sellprice = trim($_POST["sellprice"]);
if(empty($input_sellprice)){
$sellprice_err = '<b style="color: #960303; font-size: 160%">Please enter the sell price of the product.</b>';
} else{
$sellprice = $input_sellprice;
}
$input_grosssale = trim($_POST["grosssale"]);
if(empty($input_grosssale)){
$grosssale_err = '<b style="color: #960303; font-size: 160%">This field is suppose to auto-generate after typing the buy price and the sell price.<br>There is no need to manually enter an amount into this field.</b>';
} else{
$grosssale = $input_grosssale;
}
$generic = $brand = $wgtvol = $unit = $manufacturer = $buyprice = $sellprice = $grosssale = "";
if(empty($generic_err) && empty($brand_err) && empty($wgtvol_err) && empty($unit_err) && empty($manufacturer_err) && empty($buyprice_err) && empty($sellprice_err) && empty($grosssale_err)){
$sql = "INSERT INTO productslist (generic, brand, wgtvol, unit, manufacturer, buyprice, sellprice, grosssale) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
if($stmt = mysqli_prepare($link, $sql)){
mysqli_stmt_bind_param($stmt, "ssssssss", $param_generic, $param_brand, $param_wgtvol, $param_unit, $param_manufacturer, $param_buyprice, $param_sellprice, $param_grosssale);
$param_generic = $input_generic;
$param_brand = $input_brand;
$param_wgtvol = $input_wgtvol;
$param_unit = $input_unit;
$param_manufacturer = $input_manufacturer;
$param_buyprice = $input_buyprice;
$param_sellprice = $input_sellprice;
$param_grosssale = $input_grosssale;
if(mysqli_stmt_execute($stmt)){
header("location: index.php");
exit();
} else{
echo "Something went wrong. Please try again later.";
}
}
mysqli_stmt_close($stmt);
}
mysqli_close($link);
}
?>
HTML
<form class="form-wrapper" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
<div class="form-group <?php echo (!empty($brand_err)) ? 'has-error' : ''; ?>">
<label>Brand Name</label>
<input type="text" name="brand" class="form-control" value="<?php echo $brand; ?>" />
<span class="help-block"><?php echo $brand_err;?></span>
</div>
<div class="form-group <?php echo (!empty($generic_err)) ? 'has-error' : ''; ?>">
<label>Generic Name</label>
<input type="text" name="generic" class="form-control" value="<?php echo $generic; ?>" />
<span class="help-block"><?php echo $generic_err;?></span>
</div>
<div class="form-group <?php echo (!empty($wgtvol_err)) ? 'has-error' : ''; ?>">
<div class="input-group">
<label class="black-text">Weight / Volume</label>
<input type="number" step="0.01" maxlength="7" class="form-control digitOnly pull-left" id="wgtvol" name="wgtvol" value="<?php echo $wgtvol; ?>" />
<label class="sr-only black-text">Unit</label>
<select name="unit" class="form-control pull-left" id="unit" type="text" >
<option disabled value="">select</option>
<option value="mg"> mg </option>
<option value="gram(s)"> gram(s) </option>
<option value="ml"> ml </option>
<option value="liter(s)">liter(s)</option>
<option value="dl"> dl </option>
<option value="cc"> cc </option>
<option value="pc(s)"> pc(s) </option>
<option value="fl oz">fl oz</option>
<option value="gal">gal</option>
</select>
</div>
</div>
<div class="form-group <?php echo (!empty($manufacturer_err)) ? 'has-error' : ''; ?>">
<label>Manufacturer</label>
<input type="text" name="manufacturer" class="form-control" value="<?php echo $manufacturer; ?>" />
<span class="help-block"><?php echo $manufacturer_err;?></span>
</div>
<div class="form-group <?php echo (!empty($buyprice_err)) ? 'has-error' : ''; ?>">
<label>Buy Price</label>
<input type="number" step="0.01" maxlength="7" class="form-control digitOnly name="buyprice" class="form-control" value="<?php echo $buyprice; ?>" />
<span class="help-block"><?php echo $buyprice_err;?></span>
</div>=
<div class="form-group <?php echo (!empty($sellprice_err)) ? 'has-error' : ''; ?>">
<label>Sell Price</label>
<input type="number" step="0.01" maxlength="7" class="form-control digitOnly" name="sellprice" value="<?php echo $sellprice; ?>" />
<span class="help-block"><?php echo $sellprice_err;?></span>
</div>
<div class="form-group <?php echo (!empty($grosssale_err)) ? 'has-error' : ''; ?>">
<label>Gross Sale</label>
<input disabled type="number" maxlength="7" class="form-control digitOnly" name="grosssale" value="<?php echo $grosssale; ?> " />
<span class="help-block"><?php echo $grosssale_err;?></span>
</div>
<input type="submit" class="btn btn-primary" value="Add New Record" />
Cancel
</form>
You never closed the class attribute on your HTML element so the name isn't set correctly. See this bit:
class="form-control digitOnly name="buyprice"
You need to close that class with a " before the name. I'm not sure if digitOnly is another class or some HTML5 attribute.
I'd guess you wanted:
class="form-control digitOnly" name="buyprice"
You also should indent your code so it is easier to read.
Your grosssale element is disabled so it will not send. You can read more here, Disabled form inputs do not appear in the request.
I have a custom form wich have ~6 custom intuts and 1-20 can be random how can i get random inputs with $_GET and put them in col atributes:
<form method="GET" action="products.php" enctype="multipart/form-data">
<li>
<label>Name</label>
<input required class="scurtI" type="text" name="prod_name" value="<?= $_GET['prod_name'] ?>" placeholder="">
</li>
<li>
<label>Description</label>
<input required class="scurtI" type="text" name="prod_descr" value="<?= $_GET['prod_descr'] ?>" placeholder="">
</li>
<li>
<label>Meta - Title</label>
<input required class="scurtI" type="text" name="prod_meta_title" value="<?= $_GET['prod_meta_title'] ?>" placeholder="">
</li>
<li>
<label>Meta - Description</label>
<input required class="scurtI" type="text" name="prod_meta_desc" value="<?= $_GET['prod_meta_desc'] ?>" placeholder="">
</li>
<li>
<label>Meta - Keywords</label>
<input required class="scurtI" type="text" name="prod_meta_keys" value="<?= $_GET['prod_meta_keys'] ?>" placeholder="">
</li>
<li>
<label>Price</label>
<input required class="scurtI" type="text" name="prod_price" value="<?= $_GET['prod_price'] ?>" placeholder="">
</li>
<li>
<label>Currency</label>
<select name="prod_curency" class="focusSelect">
<option value="RON">RON</option>
<option value="USD">USD</option>
<option value="EUR">EUR</option>
</select>
</li>
<li>
<label>Units</label>
<input required class="scurtI" type="text" name="prod_units" value="<?= $_GET['prod_units'] ?>" placeholder="">
</li>
<li>
<label>Category</label>
<select name="prod_ctgy" class="focusSelect">
<?php
$sql = "SELECT * FROM `categorii` WHERE `cat_id`";
$connect = mysqli_query($db_connect, $sql);
while (($item = mysqli_fetch_array($connect)))
{
?>
<option
value="<?= $item['cat_id'] ?>"><?= str_repeat(' ', 6 * $item['section_level']) ?><?= $item['section_name'] ?></option>
<?php
}
?>
</select>
</li>
<li>
<label>Manufacturer</label>
<select name="prod_manu" class="focusSelect">
<?php
$sql = "SELECT * FROM `manufactures` WHERE `id`";
$connect = mysqli_query($db_connect, $sql);
while (($item = mysqli_fetch_array($connect)))
{
?>
<option
value="<?= $item['manu_code'] ?>"><?= $item['manu_name'] ?></option>
<?php
}
?>
</select>
</li>
<li>
<label>Atributes</label>
<select name="prod_atr_id" class="focusSelect">
<?php
if (isset($_GET['prod_atr_id'])){
echo "<option selected value=".$_GET['prod_atr_id'].">Selected</option>";
}
$sql = "SELECT * FROM `products_atributes` WHERE `prod_atr_id`";
$connect = mysqli_query($db_connect, $sql);
while (($item = mysqli_fetch_array($connect)))
{
?>
<option
value="<?= $item['prod_atr_id'] ?>"><?= $item['prod_atr_name'] ?></option>
<?php
}
?>
</select>
<button class="btn btn-sm btn-primary" type="submit" name="next_add_product">Next</button>
</li>
<?php
if(isset($_GET['prod_atr_id']))
{
list_atributes($_GET['prod_atr_id']);
?>
<li>
<label>Main Image </label>
<input type="file" name="prod_image" style="">
</li>
<li>
<input class="btn btn-sm btn-primary" type="submit" name="prod_add_new" value="Add Product">
</li>
</form>
<?php
}
if(isset($_GET['prod_add_new']))
{
//$prod_name = $_GET['prod_name']
foreach($_GET as $key => $value){
echo $key . " : " . $value . "<br />\r\n";
}
//print_r($all_gets);
}
?>
function list_atributes($id)
{
global $db_connect;
$atribute_detect = $id;
if ($atribute_detect > 0){
$sql = "SELECT * FROM `products_atributes` WHERE `prod_atr_parent` = '".$atribute_detect."'";
$connect = mysqli_query($db_connect, $sql);
$count = mysqli_num_rows($connect);
if ($count == 0)
{
$sql = "SELECT * FROM `products_atributes` WHERE `prod_atr_id` = '".$atribute_detect."'";
}
if ($count > 0)
{
$sql = "SELECT * FROM `products_atributes` WHERE `prod_atr_parent` = '".$atribute_detect."'";
}
$connect = mysqli_query($db_connect, $sql);
while (($item = mysqli_fetch_array($connect)))
{
echo "
<li>
<label>".$item['prod_atr_name']."</label>
<input required class='scurtI' type='text' name='".$item['prod_atr_code']."' value='".$_GET[$item['prod_atr_code']]."' >
</li>
";
}
}
}
And now i get this restults
prod_name : sadfasd
prod_descr : asdfasd
prod_meta_title : ghdf
prod_meta_desc : gs
prod_meta_keys : asdf
prod_price : 235243
prod_curency : RON
prod_units : 1243123
prod_ctgy : 16
prod_manu : 70123825
prod_atr_id : 1
26126933 : 1243ghz
40320861 : 2000mb
47789694 : 64bit
prod_image : log_masacru.png
prod_add_new : Add Product
How can i get this values, for all with prefix prod_ i have special cols, and for that with numbers i must put them all in a single col and after i must use them to extract as id=40320861 value=2000mb, etc. How can i build the code to add in db random number of $_GET values in a single column
My understanding of the question is that you need to save the following GET variables :
26126933 : 1243ghz
40320861 : 2000mb
47789694 : 64bit
in a single db column where the keys are randomly generated ( unknown).
ANSWER:
Save the attributes in a multidimensional array, for this set their name values in the html to something like prod_attr_value[][$RANDOM_NUMBER], this will make the attributes values in the array $_GET['prod_attr_value'] .
Then to save in these values in a single db column, you can simply json_encode($arr).
hth
UPDATE:
<input required class='scurtI' type='text' name='".$item['prod_atr_code']."' value='".$_GET[$item['prod_atr_code']]."' >
The above creates a $_GET var with a key having the name (not value) of the value of $item['prod_atr_code'].
Changing the name to something like prod_attr_values_arr[][$item['prod_atr_code']], will on sending the request create a array $GET['prod_attr_values_arr']
This question already has answers here:
PHP error: "Cannot pass parameter 2 by reference"
(2 answers)
Closed 1 year ago.
I have a problem with my insert query. I'm trying to get the user ID from the session variable and insert it into the table along with my other variables that is input via a form.
I have tried printing the $userid variable, and it shows up as 1, which is correct. The bind_param statement just seems to not accept it.
I keep getting this error
Cannot pass parameter 5 by reference in /*** on line 29
Line 29 is the $stmt->bind_param line.
The php code:
<?php
sec_session_start();
if (login_check($mysqli) == true) :
$table = "ticket";
$con = connect($table);
if(isset($_POST['submit'])){
$stmt = $con->prepare('INSERT INTO `ticket` (`subject`, `description`, `assigned`, `status`, `user_id`, `priority_id`, `employee_id`) VALUES (?, ?, ?, ?, ?, ?, ?)');
if (!$stmt) {
throw new Exception($con->error, $con->errno);
}
$userid = $_SESSION['id'];
$stmt->bind_param('sssssss', $_POST['post_subject'], $_POST['post_description'], $_POST['post_assigned'], 'Open', $userid, $_POST['post_priority'], $_POST['post_employee']);
if (!$stmt->execute()) {
throw new Exception($stmt->error, $stmt->errno);
}
mysqli_close($con);
}
else{
?>
This is the form:
<?php
$sql = "SELECT * FROM priority";
$result = mysqli_query($con, $sql) or die (mysql_error());
$priority_id='';
while ( $row = mysqli_fetch_array($result)){
$id=$row["id"];
$priority=$row["priority"];
$priority_id.="<OPTION VALUE=\"$id\">".$priority;
}
$sql = "SELECT * FROM members";
$result = mysqli_query($con, $sql) or die (mysql_error());
$assigned_id='';
while ( $row = mysqli_fetch_array($result)){
$id=$row["id"];
$name=$row["name"];
$assigned_id.="<OPTION VALUE=\"$id\">".$name;
}
?>
<div id="ticketSubmit">
<form action="<?php $_PHP_SELF ?>" method="post">
<fieldset>
<legend>Post content</legend>
<div>
<label for="post_subject">
<strong>Choose a subject</strong> for the post
</label>
<input id="post_subject" name="post[title]" type="text">
</div>
<div>
<label for="post_description">
<strong>Supply actual content</strong> for the post
</label>
<textarea id="post_description" name="post[description]"></textarea>
</div>
</fieldset>
<fieldset>
<legend>Post metadata</legend>
<div class="inline">
<label for="post_assigned">
<strong>Choose who assigned</strong> the post
</label>
<select id="post_assigned" name="post[assigned]">
<option> <? echo $assigned_id ?> </option>
</select>
<label for="post_category">
<strong><span style="margin-left:28px">Choose which group</strong> the post is for
</label>
<input id="post_category" name="post[category]" type="text">
<label for="post_priority">
<strong><span style="margin-left:28px">Choose priority</strong> for the post
</label>
<select id="post_priority" name="post[priority]">
<option> <? echo $priority_id ?> </option>
</select>
</div>
</fieldset>
<fieldset>
<legend>Post privacy</legend>
<div class="inline">
<input id="post_allow_comments" name="post[allow_comments]" type="checkbox">
<label for="post_allow_comments">
<strong>Allow comments</strong> on the post
</label>
</div>
<div class="inline">
<input id="post_private" name="post[private]" type="checkbox">
<label for="post_private">
<strong>Make private</strong> so that only friends see it
</label>
</div>
</fieldset>
<p>
<input name = "submit" type="submit" id="submit" value="Submit Ticket">
or
cancel and go back
</p>
</form>
</div>
You can't use 'Open' in your bind_param call. bind_param requires that each parameter is a reference.
You need to store that in a variable first.
$status = 'Open';
$stmt->bind_param('sssssss', $_POST['post_subject'], $_POST['post_description'], $_POST['post_assigned'], $status, $userid, $_POST['post_priority'], $_POST['post_employee']);