troubleshooting Question

PHP Edit page

Avatar of doctorbill
doctorbillFlag for United Kingdom of Great Britain and Northern Ireland asked on
PHPMySQL Server
1 Comment1 Solution102 ViewsLast Modified:
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>

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");

?>

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
ASKER CERTIFIED SOLUTION
doctorbill
Tech

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros