Skip to content

Instantly share code, notes, and snippets.

@dshook
Created December 22, 2021 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dshook/f3dfe229b666b8d3b48d91d2dd0eec04 to your computer and use it in GitHub Desktop.
Save dshook/f3dfe229b666b8d3b48d91d2dd0eec04 to your computer and use it in GitHub Desktop.
<?php session_start(); ?>
<script>
if (window.history.replaceState) { window.history.replaceState(null, null, window.location.href); }
</script>
<?php
header('Cache-control: no-cache, must-revalidate, max-age=0');
require('../mediaasset/db.php');
$_SESSION['prmshow'] = "display: none";
if (isset($_POST['upprm'])) {
$sqlprm = "SELECT * FROM program WHERE prmid = '$prmid'";
$resultprm = mysqli_query($db, $sqlprm) or die(mysqli_error($db));
$countprm = mysqli_num_rows($resultprm);
$rowprm = mysqli_fetch_array($resultprm);
if ($countprm = 1) {
// Insert Data
$inputprm = "UPDATE program SET pname='$_POST[pname]', ptime='$_POST[ptime]', pday='$_POST[pday]', prj1='$_POST[prj1]', prj2='$_POST[prj2]', pgraphic='$_POST[pgraphic]', ptelecast='$_POST[ptelecast]', pserial='$_POST[pserial]' WHERE prmid='$prmid'";
if (mysqli_query($db, $inputprm)) {
echo "<script type='text/javascript'> document.location = 'program.php?program=$prmid'; </script>";
exit;
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div style="max-width: 200px;width: 100%;float:right;margin-top: -3px;">
<form action="" method="get">
<select name="program" style="width: 350px;" onchange="javascript:this.form.submit()">
<option value="0" hidden>Programme List</option>
<?php
$sqlprmslt = "SELECT * FROM program ORDER BY id ASC";
$resultprmslt = mysqli_query($db, $sqlprmslt);
while ($rowprmslt = mysqli_fetch_array($resultprmslt, MYSQLI_ASSOC)) {
?>
<option value="<?php echo $rowprmslt['prmid'] ?>"><?php echo $rowprmslt['pname'] ?></option>
<?php
}
?>
</select>
</form>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment