PHP move A variable to another document - php

Hello so I am having a slight problem at the moment Basically I have a while loop that outputs a table called job from database along with a bid button that links to bid.php. When the button takes me to the page I want it to carry over the jobid of the row that the button was clicked so I can enter the specific value into my database does anyone have any ideas on how to move over currently I am trying to do it using POST but I keep getting errors and the variable dosnt seem to be moving over.I just get a blank page and the id is not displayed.
Here is findjob22.php:
<?php
require 'config.php';
if(isset($_POST['submit']))
{
$valueToSearch = $_POST['valueToSearch'];
// search in all table columns
// using concat mysql function
$query = "SELECT * FROM `job` WHERE CONCAT(`job_id`,`location`, `description`, `budget`, `duedate`,`title`) LIKE '%".$valueToSearch."%'";
$search_result = filterTable($query);
}
else {
$query = "SELECT * FROM `job`";
$search_result = filterTable($query);
}
// function to connect and execute the query
function filterTable($query)
{
$conn = mysqli_connect("localhost", "root", "", "bid4myjob");
$filter_Result = mysqli_query($conn, $query);
return $filter_Result;
}
?>
<!DOCTYPE html>
<html lang="en">
<!-- PAGE CONTENT -->
<div class="page-content page-search-result">
<div class="container">
<!-- Search Form -->
<form class="form form-horizontal" action="bid.php" method="post">
<div class="input-group input-group-lg">
<div class="input-group-btn">
<!--<select id="search-type-select" name="valueToSearch" class="multiselect multiselect-single-lg search-type-select">
<option value="all" selected="selected">All</option>
<option value="page">Page</option>
<option value="task">Task</option>
<option value="user">User</option>
<option value="image">Image</option>
</select>
</div>-->
<input class="form-control input-lg" type="text" name="valueToSearch" placeholder="type keyword ..." />
<span class="input-group-btn">
<button type="submit" name= "submit" value="Search" class="btn btn-primary btn-lg"><i class="icon ion-android-search"></i> Go</button>
</span>
</div>
</form>
<!-- End Search Form -->
</div>
</div>
<div>
<table>
<tr>
<th>id</th>
<th>Title</th>
<th>Location</th>
<th>Description</th>
<th>Budget</th>
<th>Due date</th>
</tr>
<!-- populate table from mysql database -->
<?php while($row = mysqli_fetch_array($search_result)):?>
<tr>
<?php //$jid= $row['job_id']; ?>
<td><?php echo $row['job_id']; ?></td>
<td><?php echo $row['title'];?></td>
<td><?php echo $row['location'];?></td>
<td><?php echo $row['description'];?></td>
<td><?php echo $row['price'];?></td>
<td><?php echo $row['duedate'];?></td>
<td><form method="post" action="bid.php" class="form-horizontal">
<?php //echo _("Enter ") . ' ' . $last_bid_plus . ' ' . _('or more'); ?>
<!--<div class="input-group ">
<input type="number" value="bid" class="form-control" name="bid" id= "bid" required/>
</div>
<br/>-->
<input type="submit" name="job_id" value="<?php $row['job_id']; ?>"
class="btn btn-xlarge btn-block btn-primary">bid</input>
<br/>
</form></td>
</tr>
<?php endwhile;?>
</table>
</div>
<!-- END PAGE CONTENT -->
</body>
</html>
Here is bid.php where I am trying to get the specific id of the row from findjob22.php:
<?php
// include "job.php"
$jobid = $_POST['job_id'];
echo "$jobid"
?>
<!--<html>
<div class="col-xs-8">
<div class="page-header white-content">
<h1><?= _('Your Bid') ?>.</h1>
</div>
<div class="white-content">
<div class="well">
<br/><br/>
<form method="post" action="/listings/bid/<?//=$listingID; ?>/confirm" class="form-horizontal">
<input type="hidden" value="<?=//$bid_amount?>" class="input-medium" name="bid_amount"/>
<input type="submit" name="sb_bid" value="<?php// echo _('I agree and I confirm my BID'); ?>" class="btn btn-medium btn-green" />
</form>
</div>
</div>
</div>
</html>-->

I am not sure you can pass values in the submit button, but you can use a hidden input to pass the value.
<input type="hidden" value="<?php echo $row['job_id']; ?>" name="job_id" />
<input type="submit" class="btn btn-xlarge btn-block btn-primary">bid</input>
If you want it to work like you have it use a button.
<button type="submit"
name="job_id"
value="<?php echo $row['job_id']; ?>"
class="btn btn-xlarge btn-block btn-primary">
bid
</button>
if you want to also pass some data:
<form method="post"
action="bid.php"
class="form-horizontal">
<div class="input-group">
<input type="text"
class="form-control"
name="bid"
id="bid" required />
</div>
<button type="submit"
name="job_id"
value="<?php echo $row['job_id']; ?>"
class="btn btn-xlarge btn-block btn-primary">
bid
</button>
<br/>
</form>
Then you will have a $_POST["job_id"] and $_POST["bid"] in bid.php

Related

PHP textarea input multiplies by two and outputs double input

Quick rundown:
Everything ran perfectly as it should when I had my own custom textarea field to send data
I had a custom text editor widget for inputs, but tried to add CKEditor for more functionality
When I added CKEditor package (https://ckeditor.com/ckeditor-4/download/?undefined-addons=) the editor was there, but when I clicked "Add" button and sent data, the input was doubled and there was a space between inputs (for example - input was:"test" and output was "test<br><br>test"), as if I put <br> tag and multiplied my input somewhere.
When I stopped trying with CKEditor, I went back to original code and my own original custom text editor, which before worked perfectly. However, to my surprise, it now still doubles the input string, but it doesn't put a <br> tag in between.
In DB the string value is normal and not doubled.
I have no idea how this happened, I've been going over the code for a hour or so now, trying to see if I overlooked something, but I even created a separate file with functioning code, before I was trying with CKEditor in case something broke and I could just replace it with old code and try tomorrow, but now it's messed up and I have no idea how and where.
notifications.php
<form class="form-inline" action="/action_page.php">
</form>
</nav>
<div class="container-fluid m-0 p-0">
<div class="row justify-content-center">
<div class="col-md-10">
<?php if (isset($_SESSION['response'])) { ?>
<div class="alert alert-<?= $_SESSION['res_type']; ?> alert-dismissible text-center">
<button type="button" class="close" data-dismiss="alert">×</button>
<b><?= $_SESSION['response']; ?></b>
</div>
<?php } unset($_SESSION['response']); ?>
</div>
</div>
<div class="row">
<div class="">
<?php
$query = 'SELECT * FROM crud';
$stmt = $conn->prepare($query);
$stmt->execute();
$result = $stmt->get_result();
?>
<table class="table table-hover" id="data-table">
<tbody>
<?php while ($row = $result->fetch_assoc()) { ?>
<tr>
<td></td>
<td class="pt-2"><?=
$longString=$row['name'];
$link = $row['id'];
$longStringshortcut = strlen($longString);
//echo substr($longString, 0, 100).'... Read More';
if ($longStringshortcut > 250) {
echo substr($longString, 0, 250).".. <a href='details.php?details=$link'><strong>Preberi več...</strong></a>"; }
else {
echo $longString;
}
?>
Details
Delete
Edit
</td>
</tr>
<?php } ?>
</tbody>
</table>
<div class="col-md-4 p-0">
<h5 class="">Add notification:</h5>
<form action="action.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="id" value="<?= $id; ?>">
<div class="form-group">
<textarea name="name" value="<?= $name; ?>" class="form-control" placeholder="This is the default text" required></textarea>
</div>
<div class="form-group">
<?php if ($update == true) { ?>
<input type="submit" name="update" class="btn btn-success btn-block" value="Change notification">
<?php } else { ?>
<input type="submit" name="add" class="btn btn-primary btn-block" value="Add">
<?php } ?>
</div>
<div class="form-group">
<input type="hidden" name="oldimage" value="<?= $photo; ?>">
<input type="file" name="image" class="custom-file">
<img src="<?= $photo; ?>" width="120" class="img-thumbnail">
</div>
</form>
</div>
</div>
</div>
</div>
action.php
<?php
session_start();
include 'config.php';
$update=false;
$id="";
$name="";
$photo="";
if(isset($_POST['add'])){
$name=$_POST['name'];
$photo=$_FILES['image']['name'];
$upload="uploads/".$photo;
$query="INSERT INTO crud(name,photo)VALUES(?,?)";
$stmt=$conn->prepare($query);
$stmt->bind_param("ss",$name,$upload);
$stmt->execute();
move_uploaded_file($_FILES['image']['tmp_name'], $upload);
header('location:index.php');
$_SESSION['response']="Successfully Inserted to the database!";
$_SESSION['res_type']="success";
}
The problem was with the <?= syntax (echoing), <?php solved it.

Deleting aMySQL database with a button in PHP HTML

I wanted to delete a row in mysql phpmyadmin database through a button in AssetApprovalForm.php, but when I clicked on the decline button in AssetApprovalForm.php nothing happens.
This is the image for AssetApprovalForm.php
This is my code in AssetApprovalForm.php
<form action='delete.php?SN="<?php echo $SerialNumber; ?>"' method="post">
<div class="row">
<div class="col-sm-6">
<div class="inputfield">
<input type="text" id="decline" name="decline" value="Decline" class="btn" >
</div>
</div>
</form>
<div class="col-sm-6">
<div class="inputfield">
<input type="text" id="submit" name="accept" value="Approve" class="btn">
</div>
</div>
</div>
I have included JavaScript in my AssetApprovalForm.php to perform a pop up after the button is clicked.
<script>
$("#decline").click(function(){
swal("Bruh!", "This ticket has been declined", "error");
});
</script>
<script>
$("#submit").click(function(){
swal("Nice!", "This ticket has been approved", "success");
});
</script>
This is my code for delete.php
<?php
include 'db_connection.php';
$SerialNumber = $_GET["serial"];
$query = "DELETE * FROM waiting_approval WHERE SerialNumber = '" . $SerialNumber . "'";
if(mysqli_query($conn, $query))
{
mysqli_close($conn);
header('Location: AssetApprovalList.php');
exit;
}
else
{
echo "Error declining request";
}
?>
Current:-
<div class="col-sm-6">
<div class="inputfield">
<input type="decline" id="decline" name="decline" value="Decline" class="btn">
</div>
</div>
<div class="col-sm-6">
<div class="inputfield">
<input type="text" id="submit" name="accept" value="Approve" class="btn">
</div>
</div>
I think your input type is wrong it should be type="text" not type="decline"
and for submit button it should be type="submit" not type="text"

Update Table Row Value with Post Button

I have some data in my mysql database which I am displaying in table using PHP like below
$requirement_qry="SELECT t1.*, t2.id as unit_id, t2.name as unit_name FROM `tbl_requirements`
t1 INNER JOIN tbl_units AS t2 on unit_type = t2.id AND project_id='".$_GET['project_id']."' AND user_id='".$userid."'";
$requirement_result=mysqli_query($mysqli,$requirement_qry);
<form action="" name="addeditcategory" method="post" class="form form-horizontal" enctype="multipart/form-data">
<input type="hidden" name="project_id" value="<?php echo $_GET['project_id'];?>" />
<div class="section">
<div class="section-body">
<div class="form-group">
<label class="col-md-3 control-label" >Project Name :-</label>
<div class="col-md-6">
<input type="text" name="name" id="name" value="<?php if(isset($_GET['project_id'])){echo $row['name'];}?> " class="form-control" disabled>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label" >Location :-</label>
<div class="col-md-6">
<input type="text" name="location" id="location" value="<?php if(isset($_GET['project_id'])){echo $row['location'];}?> " class="form-control" disabled>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Project Status :-</label>
<div class="col-md-6">
<select name="status" id="status" class="select2" disabled>
<?php if (!isset($_GET['project_id'])) { ?>
<option value="1">--Project Status--</option>
<?php } ?>
<option value="1" <?php echo $row['status'] == '1' ? 'selected' : ''; ?> >Open</option>
<option value="2" <?php echo $row['status'] == '2' ? 'selected' : ''; ?> >Closed</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-md-3">
<label class="control-label">Project Details :-</label>
</div>
<div class="col-md-6">
<textarea name="details" id="details" rows="4" class="form-control" disabled><?php echo stripslashes($row['details']);?></textarea>
</div>
</div>
<div class="form-group">
<div class="col-md-3">
<label class="control-label">Project Requirements :-</label>
</div>
<div class="col-md-6">
<table id="t01">
<thead>
<tr>
<th>#</th>
<th>Requirements</th>
<th>Required</th>
<th>Sent</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
while ($row1 = mysqli_fetch_array($requirement_result))
{
$id = $row1['id'];
$unit_name = $row1['unit_name'];
echo '<input type="hidden" name="reqId" id= "reqId" value="'.$id.'" />';
echo '<tr>
<td>'.$no.'</td>
<td>'.$row1['name'].'</td>
<td>'.$row1['unit_required']." ".$unit_name.'</td>
<td><input type="number" id = "received" name = "received" value ="'.$row1['unit_received'].'"/></td>
<td><button type="submit" name="submit" class="btn btn-primary" style="padding:5px 10px;">Submit</button></td>
</tr>';
$no++;
}?>
</tbody>
</table>
</div>
</div>
</div>
</form>
Above code is properly displaying my data. I have one field value from row need to update using submit button. Its working fine if there only one row...if there multiple row, its not updating data of it except last row.
My submit code is like below
if(isset($_POST['submit']) and isset($_POST['project_id']))
{
$projectId = $_GET['project_id'];
$data = array(
'unit_received' => $_POST['received']
);
$unit_edit=Update('tbl_requirements', $data, " WHERE id = '".$_POST['reqId']."'");
print_r($unit_edit);
echo $unit_edit;
if ($unit_edit > 0)
{
$_SESSION['msg']="11";
header( "Location:view_open_project.php?project_id=".$_POST['project_id']);
exit;
}
}
I am little new in PHP, Let me know if someone can help me for solve the bug.
Thanks a lot :)
As #Saji has already stated, you are replicating your name through the loop.You should rather use
echo '<input type="hidden" name="reqId[]" id= "reqId" value="'.$id.'" />';
Note the [] brackets that were appended so that you create an array of names.
To update, you need a loop like
for($i=0;$i<count($_POST['reqId']);$i++){
$unit_edit=Update('tbl_requirements', $data, " WHERE id = '".$_POST['reqId'][$i]."'");
}
What you can do is just create a hidden form where you will keep original elements. When the save button click you just find the actual value and set this to the elements inside hidden form, then trigger the submit button inside hidden form.
Note the changes I have done on your code.
1.Removed the hidden element reqId from inside loop.
2.Given a class name to the button inside loop and changed the button type from submit to button. Added data attribute data-id="'.$id.'".
3.The input received inside the loop has given unique id and name by concatenated the $id.
4.Created hidden form with hidden input in it. It has your actual input names.
5.Created a jquery function to attach click event to the button inside loop.
6.Moved the hidden element project_id to inside hidden form.
Now see the below code for more details. Hope this will help you..
<form action="" name="addeditcategory" method="post" class="form form-horizontal" enctype="multipart/form-data">
<input type="hidden" name="project_id" value="<?php echo $_GET['project_id']; ?>"/>
<div class="section">
<div class="section-body">
<div class="form-group">
<label class="col-md-3 control-label">Project Name :-</label>
<div class="col-md-6">
<input type="text" name="name" id="name" value="<?php if (isset($_GET['project_id'])) {
echo $row['name'];
} ?> " class="form-control" disabled>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Location :-</label>
<div class="col-md-6">
<input type="text" name="location" id="location" value="<?php if (isset($_GET['project_id'])) {
echo $row['location'];
} ?> " class="form-control" disabled>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Project Status :-</label>
<div class="col-md-6">
<select name="status" id="status" class="select2" disabled>
<?php if (!isset($_GET['project_id'])) { ?>
<option value="1">--Project Status--</option>
<?php } ?>
<option value="1" <?php echo $row['status'] == '1' ? 'selected' : ''; ?> >Open</option>
<option value="2" <?php echo $row['status'] == '2' ? 'selected' : ''; ?> >Closed</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-md-3">
<label class="control-label">Project Details :-</label>
</div>
<div class="col-md-6">
<textarea name="details" id="details" rows="4" class="form-control"
disabled><?php echo stripslashes($row['details']); ?></textarea>
</div>
</div>
<div class="form-group">
<div class="col-md-3">
<label class="control-label">Project Requirements :-</label>
</div>
<div class="col-md-6">
<table id="t01">
<thead>
<tr>
<th>#</th>
<th>Requirements</th>
<th>Required</th>
<th>Sent</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
while ($row1 = mysqli_fetch_array($requirement_result)) {
$id = $row1['id'];
$unit_name = $row1['unit_name'];
echo '<tr>
<td>' . $no . '</td>
<td>' . $row1['name'] . '</td>
<td>' . $row1['unit_required'] . " " . $unit_name . '</td>
<td><input type="number" id = "received' . $id . '" name = "received' . $id . '" value ="' . $row1['unit_received'] . '"/></td>
<td><button type="button" name="submit" class="btn btn-primary submit-click" data-id="' . $id . '" style="padding:5px 10px;">Submit</button></td>
</tr>';
$no++;
} ?>
</tbody>
</table>
</div>
</div>
</div>
</form>
<form action="" id="addeditcategory_temp" name="addeditcategory_temp" method="post" class="form form-horizontal" enctype="multipart/form-data" style="display:none;>
<input type="hidden" name="project_id" value="<?php echo $_GET['project_id']; ?>"/>
<input type="hidden" name="reqId" id= "reqId" value="" />
<input type="number" id = "received" name = "received" value ="">
<button id="submitButton" type="submit" name="submit" class="btn btn-primary" style="padding:5px 10px;">
</form>
<script>
$(document).ready(function(e){
$('.submit-click').off('click').on('click', function(e){
var reqId = $(this).data('id');
var received = $('#received'+reqId).val();
var form = $('#addeditcategory_temp');
form.find('#reqId').val(reqId);
form.find('#received').val(received);
form.find('#submitButton').trigger('click');
})
});
</script>

Populate a dropdown list dynamically on the same page using PHP

I'm trying to populate a drop down from values in DB on the same page which is from input on the same page itself.
I have tried a few options on the forum but it did not help.
After hitting submit it goes to a next page which is blank.
I have tried onchange=AjaxFunction(); as suggested in one post, but i still get a blank page.
Any help is appreciated.
This is my form.php
<form action="connection.php" class="form-solid-blue" method="get">
<div class="title">
<h2></h2>
<h2>Tracking & Receiving</h2></div>
<div class="element-input<?php frmd_add_class("input2"); ?>">
<label class="title"></label>
<div class="item-cont">
<input class="small" type="text" name="store" placeholder="Store #"/>
<span class="icon-place"></span>
</div>
</div>
<div class="element-input<?php frmd_add_class("input"); ?>">
<label class="title"></label>
<div class="item-cont">
<input class="medium" type="text" name="userid" placeholder="UserId"/>
<span class="icon-place"></span>
</div>
</div>
<div class="element-input<?php frmd_add_class("input1"); ?>">
<label class="title"></label>
<div class="item-cont">
<input class="large" type="text" name="order" placeholder="Order Number"/>
<span class="icon-place"></span>
</div>
</div>
<div class="submit">
<input type="submit" value="Send"/>
</div>
<div class="element-separator">
<hr>
<h3 class="section-break-title">Tracking Numbers</h3>
</div>
<div class="element-multiple<?php frmd_add_class("multiple"); ?>">
<label class="title"></label>
<div class="item-cont">
<div class="large">
<select data-no-selected="Nothing selected" name="multiple[]" multiple="multiple">
<option value="option_1">option 1</option>
<option value="option_2">option 2</option>
<option value="option_3">option 3</option>
</select>
<span class="icon-place"></span>
</div>
</div>
</div>
<div class="submit">
<input type="submit" value="Submit"/>
</div>
</form>
This is the connection.php - Server side code
<?php
// Create connection to Oracle
$conn = oci_connect("XXXX", "xyxyx", "xyxyx");
if (!$conn) {
$m = oci_error();
echo $m['message'], "\n";
exit;
}
$query = "SELECT TRACKING_NUMBER FROM JC_SHIPPED_ORDER_TRACKING WHERE EXT_PURCHASE_ORDERS_ID = :order_bv";
$stid = oci_parse($conn, $query);
$order = $_GET['order'];
oci_bind_by_name($stid, ':order_bv', $order);
oci_execute($stid);
//Because order is a unique value I only expect one row
$row = oci_fetch_array($stid, OCI_ASSOC);
if (!$row) {
exit("The order " . $order . " is invalid. Please check and try again" );
}
$trackID = $row['TRACKING_NUMBER'];
echo "<form name=form1 method=POST action='form.php'>";
//echo "<select name='TRACKING_NUMBER' onchange=AjaxFunction();>";
while ($row = oci_fetch_array($stid)) {
echo "<option value=\"option_1\">" . $row['TRACKING_NUMBER'] . "</option>";
}
echo "</select>";
//echo ("The order " . $order . " is valid.");
oci_free_statement($stid);
oci_close($conn);
?>
This is the best I can do with the information provided.
in form.php
<select data-no-selected="Nothing selected" name="multiple[]" multiple="multiple">
<?php require 'path to connection.php'; ?>
</select>
oh and remove these from connection.php
echo "<form name=form1 method=POST action='form.php'>";
echo "</select>";

get value of checkbox submit to a variable

I'm trying to work out how to get the value of a checkbox submit it to a variable which is an id from a sql db.
Below is my current code:
-- Index.php
<?php
$sql = "SELECT * FROM `file`";
if (!$result = $db->query($sql)){
die('There was an error running the query [' . $db->error . ']');
}
?>
<form method="post">
<button class="btn btn-success">New</button>
<button type="submit" class="btn btn-warning">Edit</button>
<button class="btn btn-danger">Delete</button>
<table class="table table-condensed">
<thead>
<th>#</th>
<th>Name</th>
<th>Category</th>
<th>Date</th>
</thead>
<tbody>
<?php while($row = $result->fetch_assoc()){ ?>
<td><input type="checkbox" name="id_grab" value="<?php echo $row['file_id']; ?>"></td>
<td><?php echo $row['file_name']; ?></td>
<td><?php echo $row['file_category']; ?></td>
<td><?php echo date('d-m-y', strtotime($row['file_date'])); ?></td>
</tbody>
<?php } ?>
</table>
</form>
-- file_edit.php
<?php include('../db_connect.php') ;
$id=isset($_POST['id_grab']);
$sql = "SELECT * FROM `file` WHERE file_id = $id";
if (!$result = $db->query($sql)){
die('There was an error running the query [' . $db->error . ']');
}
$row = $result->fetch_assoc();
?>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">× </button>
<h4 class="modal-title" id="myModalLabel">Edit Invoice / Receipt</h4>
</div>
<div class="modal-body">
<form action="../includes/file_update.php" method="post" role="form" enctype="multipart/form-data">
<div class="form-group">
<label for="File_Name">Name</label>
<input type="text" name="file_name" class="form-control" id="file_name" value="<?php echo $row['file_name']; ?>">
</div>
<div class="form-group">
<lable for="File_Category">Category</label>
<input type="text" name="file_category" class="form-control" id="file_category" placeholder="Financial">
</div>
<div class="form-group">
<label for="file_tag">Tag</label>
<input type="text" name="file_tag" class="form-control" id="file_tag" placeholder="statement">
</div>
<div class="form-group">
<label for="file_description">Description</label>
<input type="text" name="file_description" class="form-control" id="file_description">
</div>
<div class="form-group">
<label for="file_date">Date</label>
<input type="date" name="file_date" class="form-control" id="file_date">
</div>
<div class="form-group">
<label for="file_location">File</label>
<input type="file" class="form-control" name="file_location" value="file">
<p class="help-block">Select appropriate file for upload.</p>
</div>
<button type="button" class="btn btn-info" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-success">Upload</button>
</form>
</div>
I can't work it out, spent hours looking online... My concern is at it's using Bootstraps Modal I wasn't sure if it would be able to grat the POST data... As if I enter the ID manually it works...
Any assistance would be greatly appreciated.
change this
$id=isset($_POST['id_grab']);
to
$id=isset($_POST['id_grab'])?$_POST['id_grab']:'';
//if id_grab dont have a value then $id value will be ''
isset() Returns TRUE if var exists and has value other than NULL, FALSE otherwise.

Categories