Avatar of doctorbill
doctorbill
Flag for United Kingdom of Great Britain and Northern Ireland asked on

PHP Edit page

Source page:
<?php
    include('SupportTicketsConnect.php');
	$id=$_GET['id'];
	$result = $db->prepare("SELECT * FROM support WHERE sup_id= :userid");
	$result->bindParam(':userid', $id);
	$result->execute();
	for($i=0; $row = $result->fetch(); $i++){
    ?>
   
<form action="SupportTicketsUpdate.php" method="post" name="dataentry">
    
   <?php
    $ticketnumber = rand(1, 1000000);
    
 ?>
   
    <input type="hidden" name="ticketnum" value="<?php echo $id+1;?>"/>
    Ticket Number: #<?php echo $id+1;?><br /><br />
    
    <input type="hidden" name="supid" value="<?php echo $row['sup_id']; ?>" />
    
    <Label>Status of Ticket :&nbsp;&nbsp;</Label><input type="radio" name="radnew" value="New Ticket" <?php if ($row['radnew']== 'New Ticket') echo "checked='checked'"; ?>>&nbsp;New Ticket</input>
    &nbsp;<input type="radio" name="radnew" value="nocategory" <?php if ($row['radnew']== 'nocategory') echo "checked='checked'"; ?>>&nbsp;No Category</input><br /><br />
<Label>Origin of Ticket :&nbsp;&nbsp;</Label><input type="checkbox" name="emailsupport" value="emailsupport" <?php if ($row['chkemail']== 'emailsupport') echo "checked='checked'"; ?> />&nbsp;email to support
    &nbsp;<input type="checkbox" name="phonesupport" value="phonesupport" <?php if ($row['chkphone']== 'phonesupport') echo "checked='checked'"; ?> />&nbsp;Phone to support
    &nbsp;<input type="checkbox" name="smssupport" value="smssupport" <?php if ($row['chksms']== 'smssupport') echo "checked='checked'"; ?>/>&nbsp;SMS to support
    &nbsp;<input type="checkbox" name="projectsupport" value="projectsupport" <?php if ($row['chkproject']== 'projectsupport') echo "checked='checked'"; ?>/>&nbsp;Project work<br /><br />

    <label>Company  :</label>
<input type="text" name="sup_company" id="company" required="required"  placeholder="Enter the Company Name"/><br/>
     <select name="companydropdown" onchange="company_change()">
    <?php foreach($details3 as $company): ?>
        <option value="<?= $company['id']; ?>"><?= $company['inv_companyname']; ?></option>
    <?php endforeach; ?>
    </select><br /><br /> 
<label>Contact Name  :</label>
<input type="text" name="sup_name" id="contactname" required="required" placeholder="Enter Contact Name"/><br />
    <select name="sitename" onchange="company_change_sitename()">
    <?php foreach($details as $sitename): ?>
        <option value="<?= $sitename['id']; ?>"><?= $sitename['sites_name']; ?></option>
    <?php endforeach; ?>
    </select><br /><br /> 
<label>Contact Email  :</label>
<input type="email" name="sup_email" id="contactemail" required="required" value="<?php echo $row['sup_email']; ?>"/><br/>
    <select name="siteemail" onchange="email_change()">
    <?php foreach($details4 as $sitename): ?>
        <option value="<?= $sitename['id']; ?>"><?= $sitename['sites_email']; ?></option>
    <?php endforeach; ?>
    </select><br /><br /> 
<label>Contact Phone Number  :</label>
<input type="text" name="sup_phone" id="supphone" required="required"  placeholder="Contact phone"/><br/>
    <select name="sitephone" onchange="phone_change()">
    <?php foreach($details4 as $sitename): ?>
        <option value="<?= $sitename['id']; ?>"><?= $sitename['sites_email']; ?></option>
    <?php endforeach; ?>
    </select><br /><br /> 
<label>Inventas Representative  :</label>
<input type="text" name="sup_rep" id="rep" required="required"  placeholder="Inventas Representative"/><br/>
    <select name="repdropdown" onchange="rep_change()">
    <?php foreach($details2 as $invrep): ?>
        <option value="<?= $invrep['id']; ?>"><?= $invrep['inv_names']; ?></option>
    <?php endforeach; ?>
    </select><br /><br /> 
<label>Comments  :</label>
<textarea name="sup_comments" type="text" class="commenttext" ><?php echo $row['sup_comments']; ?></textarea><br/><br />
<label>Additional Comments (Limit 3 fields) :</label>
<div id="addinput">
<p>
<a href="#" id="addNew">Add</a>
    <a href="" id="addattchment">
</p><br />
    <p>
<a href="DropZone/index_database_working_grid_3columns_edit_SUPPORT.php?ticketid=<?php echo $ticketnumber; ?>" id="addattachment" target="_blank">Add Attachments associated with this ticket</a>
    
</p>
</div><br />

<label>ToDo  :</label>
<textarea name="sup_todo" type="text" class="commenttext" required="required"  placeholder="ToDo"></textarea><br/><br />
<label>Time Worked on - From  :</label>
<input type="text" name="time_from" id="timepicker" required="required" placeholder="<?php echo date('H:i:s'); ?>"/><br />
    <select name="time" onchange="from_change()"><?php echo get_times(); ?></select>&nbsp; Pick a Start Time<br /><br />
    <label>Time Worked on - To  :</label>
<input type="text" name="time_to" id="timepicker" required="required" placeholder="<?php echo date('H:i:s'); ?>"/><br />
    <select name="time2" onchange="to_change()"><?php echo get_times(); ?></select>&nbsp; Pick an End Time<br /><br />
<label>Date Entered  :</label>
<input type="text" name="sup_date" id="datepicker" required="required" placeholder="<?php echo date('Y-m-d'); ?>"/><br /><br />   
              

<input type="submit" value=" Submit " name="submit"/><br />
</form>
    
<?php
	}
?>
</div>

Open in new window


Edit Page (SupportTicketsUpdate.php):

<?php


// configuration
include('SupportTicketsConnect.php');

// new data
$company = $_POST['sup_company'];
$contact = $_POST['sup_name'];
$email = $_POST['sup_email'];
$phone = $_POST['sup_phone'];
$rep = $_POST['sup_rep'];
$comments = $_POST['sup_comments'];
$comments1 = $_POST['p_new_3'];
$comments2 = $_POST['p_new_4'];
$comments3 = $_POST['p_new_5'];
$todo = $_POST['sup_todo'];
$from = $_POST['time_from'];
$to = $_POST['time_to'];
$date = $_POST['sup_date'];
$radio = $_POST['radnew'];
$chkemail = $_POST['emailsupport'];
$chkphone = $_POST['phonesupport'];
$chksms = $_POST['smssupport'];
$chkproject = $_POST['projectsupport'];
$id = $_POST['supid'];
// query
$sql = "UPDATE support 
        SET sup_company=?, sup_contact=?, sup_email=?, sup_phone=?, sup_rep=?, sup_comments=?, sup_addcom1=?, sup_addcom2=?, sup_addcom3=?, sup_todo=?, sup_timefrom=?, sup_timeto?, sup_date=?, radnew=?, chkemail=?, chkphone=?, chksms=?, chkproject=?
		WHERE sup_id=?";
$q = $db->prepare($sql);
$q->execute(array($company,$contact,$email,$phone,$rep,$comments,$comments1,$comments2,$comments3,$todo,$from,$to,$date,$radio,$chkemail,$chkphone,$chksms,$chkproject,$id));
header("location: ../index.php");

?>

Open in new window


The above code:
The source code page is the code I am trying to edit using the edit code page
I have a similar pages which are working but this just REFUSES to update
PLEASE PLEASE can someone shed some light as to why the code is not updating
PHPMySQL Server

Avatar of undefined
Last Comment
doctorbill

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
doctorbill

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy