Copy link to clipboard
Copied
Hi
I have a form that works but does not move from where it is after the submit button is clicked.
Please advice
Hi
I am closing this post as I have solved this and resolved this thru discussions.
Copy link to clipboard
Copied
Question regarding server side scripting and database belong in the app dev forum. There, you will need to provide more details about the problem - scripting language, database, and examples of your code.
Copy link to clipboard
Copied
<?php require_once('Connections/dbAttendance.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO attendlist (Windowsid, title, firstname, surname, extension, mobile, jobrole, course, cpg, mgrname, room) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Wid'], "text"),
GetSQLValueString($_POST['title'], "text"),
GetSQLValueString($_POST['firstname'], "text"),
GetSQLValueString($_POST['surname'], "text"),
GetSQLValueString($_POST['contactno'], "text"),
GetSQLValueString($_POST['mobile'], "text"),
GetSQLValueString($_POST['jobrole'], "text"),
GetSQLValueString($_POST['courses'], "text"),
GetSQLValueString($_POST['cpg2'], "text"),
GetSQLValueString($_POST['mgrname2'], "text"),
GetSQLValueString($_POST['troom'], "text"));
mysql_select_db($database_attending, $attending);
$Result1 = mysql_query($insertSQL, $attending) or die(mysql_error());
$insertGoTo = "ReportbyAll.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_dbAttendance, $dbAttendance);
$query_rsattendance = "SELECT * FROM attendlist";
$rsattendance = mysql_query($query_rsattendance, $dbAttendance) or die(mysql_error());
$row_rsattendance = mysql_fetch_assoc($rsattendance);
$totalRows_rsattendance = mysql_num_rows($rsattendance);
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO attendlist (title, firstname, surname, extension, mobile, jobrole, course, cpg, mgrname, room, Adate) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['title'], "text"),
GetSQLValueString($_POST['firstname'], "text"),
GetSQLValueString($_POST['surname'], "text"),
GetSQLValueString($_POST['contactno'], "text"),
GetSQLValueString($_POST['mobile'], "text"),
GetSQLValueString($_POST['jobrole'], "text"),
GetSQLValueString($_POST['courses'], "text"),
GetSQLValueString($_POST['cpg2'], "text"),
GetSQLValueString($_POST['mgrname2'], "text"),
GetSQLValueString($_POST['troom'], "text"),
GetSQLValueString($_POST['Adate2'], "date"));
mysql_select_db($database_attending, $attending);
$Result1 = mysql_query($insertSQL, $attending) or die(mysql_error());
$insertGoTo = "Listing.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
} ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Register</title>
<style type="text/css">
body {
font: 100%/0.8 Verdana, Arial, Helvetica, sans-serif;
background-color: #4E5869;
margin: 0;
padding: 0;
color: #000;
}
/* ~~ Element/tag selectors ~~ */
ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
padding: 0;
margin: 0;
}
h1, h2, h3, h4, h5, h6, p {
margin-top: 0; /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */
padding-right: 15px;
padding-left: 15px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */
}
a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
border: none;
}
/* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
a:link {
color:#414958;
text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
}
a:visited {
color: #4E5869;
text-decoration: underline;
}
a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
text-decoration: none;
}
/* ~~ this container surrounds all other divs giving them their percentage-based width ~~ */
.container {
width: 80%;
max-width: 960px;/* a max-width may be desirable to keep this layout from getting too wide on a large monitor. This keeps line length more readable. IE6 does not respect this declaration. */
min-width: 780px;/* a min-width may be desirable to keep this layout from getting too narrow. This keeps line length more readable in the side columns. IE6 does not respect this declaration. */
background-color: #FFF;
margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout. It is not needed if you set the .container's width to 100%. */
}
/* ~~the header is not given a width. It will extend the full width of your layout. It contains an image placeholder that should be replaced with your own linked logo~~ */
.header {
background-color: #6F7D94;
}
/* ~~ This is the layout information. ~~
1) Padding is only placed on the top and/or bottom of the div. The elements within this div have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the div itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the div and place a second div within it with no width and the padding necessary for your design.
*/
.content {
padding: 10px 0;
}
/* ~~ This grouped selector gives the lists in the .content area space ~~ */
.content ul, .content ol {
padding: 0 15px 15px 40px; /* this padding mirrors the right padding in the headings and paragraph rule above. Padding was placed on the bottom for space between other elements on the lists and on the left to create the indention. These may be adjusted as you wish. */
}
/* ~~ The footer ~~ */
.footer {
padding: 10px 0;
background-color: #6F7D94;
}
/* ~~ miscellaneous float/clear classes ~~ */
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
float: right;
margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */
float: left;
margin-right: 8px;
}
.clearfloat { /* this class can be placed on a or empty div as the final element following the last floated div (within the #container) if the #footer is removed or taken out of the #container */
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
</style>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
<script language='JavaScript' type='text/javascript' src='TSScript/yahoo.js'></script>
<script language='JavaScript' type='text/javascript' src='TSScript/event.js'></script>
<script language='JavaScript' type='text/javascript' src='TSScript/dom.js'></script>
<script language='JavaScript' type='text/javascript' src='TSScript/calendar.js'></script>
<link rel='stylesheet' type='text/css' href='TSScript/TSCalendar/calendar.css' />
<script language='JavaScript' type='text/javascript' src='TSScript/TSCalendar/TSCalendar.js'></script>
</head>
<body>
<div class="container">
<div class="header">
<img src="Cerner At Imperial2.jpg" width="960" height="150" alt="" />
</div>
<div class="content">
<h3>Attendance Register: </h3>
<p><?php echo "Date ".date("d/m/Y");?></p>
<form action="<?php echo $editFormAction;?>" id="form1" name="form1" method="post">
<table width="780" border="0" cellspacing="10" summary="Cerner@Imperial">
<tr>
<td><div align="right">* User ID</div></td>
<td colspan="2"><span id="sprytextfield1">
<input name="Wid" type="text" id="Wid" tabindex="1" size="18" maxlength="10" />
<span class="textfieldRequiredMsg"> a value is required.</span></span></td>
<td> </td>
</tr>
<tr>
<td><div align="right">* Title</div></td>
<td colspan="2"><span id="spryselect1">
<select name="title" id="title" tabindex="2">
<option value="0">Select</option>
<option value="Ms">Ms</option>
<option value="Mrs">Mrs</option>
<option value="Mdm">Mdm</option>
<option value="Mr">Mr</option>
<option value="Dr">Dr</option>
<option value="Professor">Prof</option>
</select>
<span class="selectRequiredMsg"> Please select an item.</span></span></td>
<td> </td>
</tr>
<tr>
<td><div align="right">* First name</div></td>
<td colspan="2"><span id="sprytextfield2">
<input name="firstname" type="text" id="firstname" tabindex="3" size="40" maxlength="30" />
<span class="textfieldRequiredMsg"> a value is required.</span></span></td>
<td> </td>
</tr>
<tr>
<td><div align="right">* Surname</div></td>
<td colspan="2"><span id="sprytextfield5">
<input name="surname" type="text" id="surname" tabindex="4" size="40" maxlength="30" />
<span class="textfieldRequiredMsg"> a value is required.</span></span></td>
<td> </td>
</tr>
<tr>
<td><div align="right">* Contact/ Bleep</div></td>
<td colspan="2"><span id="sprytextfield3">
<input name="contactno" type="text" id="contactno" tabindex="5" size="10" maxlength="6" />
<span class="textfieldRequiredMsg">a value is required.</span></span></td>
<td> </td>
</tr>
<tr>
<td><div align="right">Mobile (optional)</div></td>
<td colspan="2"><input name="mobile" type="text" id="mobile" tabindex="6" size="25" maxlength="18" /> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td><div align="right">* Job role</div></td>
<td colspan="2"><span id="spryselect2">
<select name="jobrole" id="jobrole" tabindex="7">
<option value="0">Select</option>
<option value="Doctor">Doctor</option>
<option value="CNS/NP">CNS/NP</option>
<option value="Midwife">Midwife</option>
<option value="Other Staff">Other Staff</option>
<option value="Nurse IP HCA">Nurse IP & HCA</option>
<option value="Nurse OP HCA">Nurse OP & HCA</option>
<option value="IP Physician Assitant">IP Physician Assistant</option>
<option value="OP Phlebotomist">OP Phlebotmist</option>
<option value="Pharmacists">Pharmacists</option>
<option value="Therapist AHP">Therapist & AHP</option>
<option value="Medical Secretary">Medical Secretary</option>
<option value="Bed Manager">Bed Manager</option>
<option value="Medical Record Staff">Medical Records</option>
<option value="Medical Records Manager">Medical Records Mgr</option>
<option value="OP Booking Clerk">OP Booking Clerk</option>
<option value="OP Receptionist">OP Receptionist</option>
<option value="ED Admin">ED Admin</option>
<option value="Ward Administrator">Ward Administrator</option>
<option value="IP Wait List Clerk/Mgr">IP Wait List Clerk/Mgr</option>
<option value="Antenatal Supervisor">Antenatal Supervisor</option>
<option value="Clinical Coder">Clinical Coder</option>
<option value="Clinical Coding Mgr">Clinical Coding Mgr</option>
<option value="Pi Help Desk Backoffice">Pi Help Desk Analyst/Back Office</option>
</select>
<span class="selectInvalidMsg">Please select a valid item.</span></span></td>
<td> </td>
</tr>
<tr>
<td><div align="right">* Manager's Name</div></td>
<td colspan="2"><span id="sprytextfield4">
<input name="mgrname2" type="text" id="mgrname2" tabindex="8" size="40" maxlength="30" />
<span class="textfieldRequiredMsg"> a value is required.</span></span></td>
<td> </td>
</tr>
<tr>
<td><div align="right"></div></td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td><div align="right">* Course</div></td>
<td colspan="2"><span id="spryselect3">
<select name="courses" id="courses" tabindex="10" title="course">
<option value="0">Select</option>
<option value="Doctors">Doctors</option>
<option value="Nurse IP">Nurse IP</option>
<option value="Nurse OP">Nurse OP</option>
<option value="Midwife">Midwife</option>
<option value="HCA">HCA</option>
<option value="Pharmacist">Pharmacist</option>
<option value="Back Office Staff">Back Office Staff</option>
<option value="AHP">AHP</option>
<option value="Pi Help Desk Analyst">Pi Help Desk Analyst</option>
<option value="Medical Secretary">Medical Secretary</option>
<option value="OP Phlebotmist">OP Phlebotmist</option>
<option value="Champion Users Doctors">Champion Users Doctors</option>
<option value="Champion Users Nurse IP">Champion Users Nurse IP</option>
</select>
<span class="selectRequiredMsg">Please select an item.</span></span></td>
<td> </td>
</tr>
<tr>
<td><div align="right">* Training Location </div></td>
<td><span id="spryselect4">
<select name="troom" id="troom" tabindex="11" title="location">
<option value="0">Select</option>
<option value="CXH">Charing Cross</option>
<option value="HH">Hammersmith Hammersmith</option>
<option value="QEH">Queen Charlottee Hospital</option>
<option value="SMH">St Mary's Hospital</option>
<option value="WEH">Western Eye Hospital</option>
<option value="SCC">St Charles Community</option>
</select>
<span class="selectRequiredMsg">Please select an item.</span></span></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><div align="right">* CPG</div></td>
<td><span id="spryselect5">
<select name="cpg2" id="cpg2" tabindex="12" title="cpg">
<option value="0">Select</option>
<option value="CPG 1 Medicine">CPG1 - Medicine</option>
<option value="CPG 2 Surgery & Cancer">CPG2 - Surgery and Cancer</option>
<option value="CPG3 Specialist Services">CPG3 - Specialist Services</option>
<option value="CPG4 Circulatory Services and Renal Medicine">CPG4 - Circulatory Services and Renal Medicine</option>
<option value="CPG5 Womens and Childrens">CPG5 - Womens and Childrens</option>
<option value="CPG6 Clinical and Investigative Sciences">CPG6 - Clinical and Investigative Sciences</option>
<option value="CP7 Private Patients">CPG7 - Private Patients</option>
<option value="Others">Others</option>
</select>
<span class="selectRequiredMsg">Please select an item.</span></span></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="submitbt" id="submitbt" value="Submit" /></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td><div align="center">* Mandatory Fields</div></td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p> </p>
<p> </p>
<div class="footer">
<script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur", "change"]});
var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {validateOn:["blur", "change"]});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {validateOn:["blur", "change"]});
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "none", {validateOn:["blur", "change"]});
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "integer", {validateOn:["blur", "change"]});
var spryselect2 = new Spry.Widget.ValidationSelect("spryselect2", {invalidValue:"-1", isRequired:false, validateOn:["blur", "change"]});
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "none", {validateOn:["blur"]});
var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "none", {validateOn:["blur", "change"]});
var spryselect3 = new Spry.Widget.ValidationSelect("spryselect3");
var spryselect4 = new Spry.Widget.ValidationSelect("spryselect4");
var spryselect5 = new Spry.Widget.ValidationSelect("spryselect5", {validateOn:["blur", "change"]});
</script>
</div>
</div>
<p>
<a href="http://validator.w3.org/check?uri=referer"><img
src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>
</p>
<P></P>
</div>
</body>
</html>
<?php
mysql_free_result($rsattendance);
?>
Copy link to clipboard
Copied
Moved thread to Developing server-side applications in DW for better responses.
Copy link to clipboard
Copied
What actually is the problem? Are you getting errors or just that the data is not inserted into the table? It appears that you have two similar insert statements and related php code in your script. Did you manually edit any DW behavior generated code?
Try removing the incorrect INSERT statement related code and see if that resolves the problem.
Copy link to clipboard
Copied
I didnt hand code it if thats what you are asking. On clicking the submit button nothing happens. No data inserted to the table when checked. It is suppose to go to another page. Which lines are duplicates? Line no? All coded by DW.
Copy link to clipboard
Copied
>I didnt hand code it if thats what you are asking.
I'm asking if you made ANY modifications to code that DW generated.
The duplicate lines of code start with:
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
The column list in each is slightly different, and each redirects to a different page - one to "ReportbyAll.php" and the other to "Listing.php". What is the file name of the page you posted?
Copy link to clipboard
Copied
Modifications to correct misplaced tags. Nothing on server side. Thanks.
Copy link to clipboard
Copied
Hi I have posted ReportbbAll.php. This is on the server. It should direct to this page once the user click on the submit button. It will then display all records to date.
I have not made any modification to the code. Are you suggesting that I now remove the duplicate code. Please advice. I will remove them if you could give me a astart and finish to lines of code to delete. Also there should be no reference to Listing.php. Please advice.
Thank you.
Copy link to clipboard
Copied
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO attendlist (Windowsid, title, firstname, surname, extension, mobile, jobrole, course, cpg, mgrname, room) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Wid'], "text"),
GetSQLValueString($_POST['title'], "text"),
GetSQLValueString($_POST['firstname'], "text"),
GetSQLValueString($_POST['surname'], "text"),
GetSQLValueString($_POST['contactno'], "text"),
GetSQLValueString($_POST['mobile'], "text"),
GetSQLValueString($_POST['jobrole'], "text"),
GetSQLValueString($_POST['courses'], "text"),
GetSQLValueString($_POST['cpg2'], "text"),
GetSQLValueString($_POST['mgrname2'], "text"),
GetSQLValueString($_POST['troom'], "text"));
mysql_select_db($database_attending, $attending);
$Result1 = mysql_query($insertSQL, $attending) or die(mysql_error());
$insertGoTo = "ReportbyAll.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_dbAttendance, $dbAttendance);
$query_rsattendance = "SELECT * FROM attendlist";
$rsattendance = mysql_query($query_rsattendance, $dbAttendance) or die(mysql_error());
$row_rsattendance = mysql_fetch_assoc($rsattendance);
$totalRows_rsattendance = mysql_num_rows($rsattendance);
Is this the duplicate set of code? I notice the field set is an old one as I have included Adate in the filed. in the table.
I am not sure how far down the duplication goes, I suppose it will be when the same above code starts ? right? But the file to goto or page to go when submit to click is the correct one - ReportbyAll.php Where the other duplicate code has the new structure but has the incorrect on subimit page - Listing.php
Please advise.
Copy link to clipboard
Copied
So shall I take out this block of code. This block of code is duplicate, right.
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO attendlist (Windowsid, title, firstname, surname, extension, mobile, jobrole, course, cpg, mgrname, room) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Wid'], "text"),
GetSQLValueString($_POST['title'], "text"),
GetSQLValueString($_POST['firstname'], "text"),
GetSQLValueString($_POST['surname'], "text"),
GetSQLValueString($_POST['contactno'], "text"),
GetSQLValueString($_POST['mobile'], "text"),
GetSQLValueString($_POST['jobrole'], "text"),
GetSQLValueString($_POST['courses'], "text"),
GetSQLValueString($_POST['cpg2'], "text"),
GetSQLValueString($_POST['mgrname2'], "text"),
GetSQLValueString($_POST['troom'], "text"));
mysql_select_db($database_attending, $attending);
$Result1 = mysql_query($insertSQL, $attending) or die(mysql_error());
$insertGoTo = "ReportbyAll.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_dbAttendance, $dbAttendance);
$query_rsattendance = "SELECT * FROM attendlist";
$rsattendance = mysql_query($query_rsattendance, $dbAttendance) or die(mysql_error());
$row_rsattendance = mysql_fetch_assoc($rsattendance);
$totalRows_rsattendance = mysql_num_rows($rsattendance)
When I have taken this block of duplicate code out, i only need to edit and change the go to page file. Change it to ReportbyAll.php instead of Listing.php
Please advice.
Copy link to clipboard
Copied
It looks like the source copy does not have the duplication. The copy I am referring to is the htm souce copy, it does not have the duplication.
So shall I edit the php source copy?
Shall I take - out these lines:
(php source copy)
Copy link to clipboard
Copied
>It looks like the source copy does not have the duplication. The copy I am referring to is the htm souce copy, it does >not have the duplication.
>
>So shall I edit the php source copy?
Sorry, I'm not sure what you mean by 'htm source copy'. PHP files have a combination of PHP server code and html code. Please explain what you are asking.
Copy link to clipboard
Copied
Hi,
Sorry for the slight delay on my reply. Some idiot got into your system and posted against each post I tried to post. Harressing me each post I make with the same replies.
I have report this. Took awhile to get to this point.
I have tried editing the file and it got worse. So your offer of editing it and correcting the problem will have to take it from this listing below.
Posting it now.
<?php require_once('Connections/dbAttendance.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
}
mysql_select_db($database_dbAttendance, $dbAttendance);
$query_rsattendance = "SELECT * FROM attendlist";
$rsattendance = mysql_query($query_rsattendance, $dbAttendance) or die(mysql_error());
$row_rsattendance = mysql_fetch_assoc($rsattendance);
$totalRows_rsattendance = mysql_num_rows($rsattendance);
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO attendlist (title, firstname, surname, extension, mobile, jobrole, course, cpg, mgrname, room, Adate) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['title'], "text"),
GetSQLValueString($_POST['firstname'], "text"),
GetSQLValueString($_POST['surname'], "text"),
GetSQLValueString($_POST['contactno'], "text"),
GetSQLValueString($_POST['mobile'], "text"),
GetSQLValueString($_POST['jobrole'], "text"),
GetSQLValueString($_POST['courses'], "text"),
GetSQLValueString($_POST['cpg2'], "text"),
GetSQLValueString($_POST['mgrname2'], "text"),
GetSQLValueString($_POST['troom'], "text"),
GetSQLValueString($_POST['Adate2'], "date"));
mysql_select_db($database_dbAttendance, $dbAttendance);
$Result1 = mysql_query($insertSQL, $dbAttendance ) or die(mysql_error());
$insertGoTo = "ReportbyAll.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
mysql_select_db($database_dbAttendance, $dbAttendance);
$query_rsattendance = "SELECT * FROM attendlist";
$rsattendance = mysql_query($query_rsattendance, $dbAttendance) or die(mysql_error());
$row_rsattendance = mysql_fetch_assoc($rsattendance);
$totalRows_rsattendance = mysql_num_rows($rsattendance);
} ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Register</title>
<style type="text/css">
body {
font: 100%/0.8 Verdana, Arial, Helvetica, sans-serif;
background-color: #4E5869;
margin: 0;
padding: 0;
color: #000;
}
/* ~~ Element/tag selectors ~~ */
ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
padding: 0;
margin: 0;
}
h1, h2, h3, h4, h5, h6, p {
margin-top: 0; /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */
padding-right: 15px;
padding-left: 15px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */
}
a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
border: none;
}
/* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
a:link {
color:#414958;
text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
}
a:visited {
color: #4E5869;
text-decoration: underline;
}
a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
text-decoration: none;
}
/* ~~ this container surrounds all other divs giving them their percentage-based width ~~ */
.container {
width: 80%;
max-width: 960px;/* a max-width may be desirable to keep this layout from getting too wide on a large monitor. This keeps line length more readable. IE6 does not respect this declaration. */
min-width: 780px;/* a min-width may be desirable to keep this layout from getting too narrow. This keeps line length more readable in the side columns. IE6 does not respect this declaration. */
background-color: #FFF;
margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout. It is not needed if you set the .container's width to 100%. */
}
/* ~~the header is not given a width. It will extend the full width of your layout. It contains an image placeholder that should be replaced with your own linked logo~~ */
.header {
background-color: #6F7D94;
}
/* ~~ This is the layout information. ~~
1) Padding is only placed on the top and/or bottom of the div. The elements within this div have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the div itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the div and place a second div within it with no width and the padding necessary for your design.
*/
.content {
padding: 10px 0;
}
/* ~~ This grouped selector gives the lists in the .content area space ~~ */
.content ul, .content ol {
padding: 0 15px 15px 40px; /* this padding mirrors the right padding in the headings and paragraph rule above. Padding was placed on the bottom for space between other elements on the lists and on the left to create the indention. These may be adjusted as you wish. */
}
/* ~~ The footer ~~ */
.footer {
padding: 10px 0;
background-color: #6F7D94;
}
/* ~~ miscellaneous float/clear classes ~~ */
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
float: right;
margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */
float: left;
margin-right: 8px;
}
.clearfloat { /* this class can be placed on a or empty div as the final element following the last floated div (within the #container) if the #footer is removed or taken out of the #container */
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
</style>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
<script language='JavaScript' type='text/javascript' src='TSScript/yahoo.js'></script>
<script language='JavaScript' type='text/javascript' src='TSScript/event.js'></script>
<script language='JavaScript' type='text/javascript' src='TSScript/dom.js'></script>
<script language='JavaScript' type='text/javascript' src='TSScript/calendar.js'></script>
<link rel='stylesheet' type='text/css' href='TSScript/TSCalendar/calendar.css' />
<script language='JavaScript' type='text/javascript' src='TSScript/TSCalendar/TSCalendar.js'></script>
</head>
<body>
<div class="container">
<div class="header">
<img src="Cerner At Imperial2.jpg" width="960" height="150" alt="" />
</div>
<div class="content">
<h3>Attendance Register: </h3>
<p><?php echo "Date ".date("d/m/Y");?></p>
<form action="<?php echo $editFormAction;?>" id="form1" name="form1" method="post">
<table width="780" border="0" cellspacing="10" summary="Cerner@Imperial">
<tr>
<td><div align="right">* User ID</div></td>
<td colspan="2"><span id="sprytextfield1">
<input name="Wid" type="text" id="Wid" tabindex="1" size="18" maxlength="10" />
<span class="textfieldRequiredMsg"> a value is required.</span></span></td>
<td> </td>
</tr>
<tr>
<td><div align="right">* Title</div></td>
<td colspan="2"><span id="spryselect1">
<select name="title" id="title" tabindex="2">
<option value="0">Select</option>
<option value="Ms">Ms</option>
<option value="Mrs">Mrs</option>
<option value="Mdm">Mdm</option>
<option value="Mr">Mr</option>
<option value="Dr">Dr</option>
<option value="Professor">Prof</option>
</select>
<span class="selectRequiredMsg"> Please select an item.</span></span></td>
<td> </td>
</tr>
<tr>
<td><div align="right">* First name</div></td>
<td colspan="2"><span id="sprytextfield2">
<input name="firstname" type="text" id="firstname" tabindex="3" size="40" maxlength="30" />
<span class="textfieldRequiredMsg"> a value is required.</span></span></td>
<td> </td>
</tr>
<tr>
<td><div align="right">* Surname</div></td>
<td colspan="2"><span id="sprytextfield5">
<input name="surname" type="text" id="surname" tabindex="4" size="40" maxlength="30" />
<span class="textfieldRequiredMsg"> a value is required.</span></span></td>
<td> </td>
</tr>
<tr>
<td><div align="right">* Contact/ Bleep</div></td>
<td colspan="2"><span id="sprytextfield3">
<input name="contactno" type="text" id="contactno" tabindex="5" size="10" maxlength="6" />
<span class="textfieldRequiredMsg">a value is required.</span></span></td>
<td> </td>
</tr>
<tr>
<td><div align="right">Mobile (optional)</div></td>
<td colspan="2"><input name="mobile" type="text" id="mobile" tabindex="6" size="25" maxlength="18" /> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td><div align="right">* Job role</div></td>
<td colspan="2"><span id="spryselect2">
<select name="jobrole" id="jobrole" tabindex="7">
<option value="0">Select</option>
<option value="Doctor">Doctor</option>
<option value="CNS/NP">CNS/NP</option>
<option value="Midwife">Midwife</option>
<option value="Other Staff">Other Staff</option>
<option value="Nurse IP HCA">Nurse IP & HCA</option>
<option value="Nurse OP HCA">Nurse OP & HCA</option>
<option value="IP Physician Assitant">IP Physician Assistant</option>
<option value="OP Phlebotomist">OP Phlebotmist</option>
<option value="Pharmacists">Pharmacists</option>
<option value="Therapist AHP">Therapist & AHP</option>
<option value="Medical Secretary">Medical Secretary</option>
<option value="Bed Manager">Bed Manager</option>
<option value="Medical Record Staff">Medical Records</option>
<option value="Medical Records Manager">Medical Records Mgr</option>
<option value="OP Booking Clerk">OP Booking Clerk</option>
<option value="OP Receptionist">OP Receptionist</option>
<option value="ED Admin">ED Admin</option>
<option value="Ward Administrator">Ward Administrator</option>
<option value="IP Wait List Clerk/Mgr">IP Wait List Clerk/Mgr</option>
<option value="Antenatal Supervisor">Antenatal Supervisor</option>
<option value="Clinical Coder">Clinical Coder</option>
<option value="Clinical Coding Mgr">Clinical Coding Mgr</option>
<option value="Pi Help Desk Backoffice">Pi Help Desk Analyst/Back Office</option>
</select>
<span class="selectInvalidMsg">Please select a valid item.</span></span></td>
<td> </td>
</tr>
<tr>
<td><div align="right">* Manager's Name</div></td>
<td colspan="2"><span id="sprytextfield4">
<input name="mgrname2" type="text" id="mgrname2" tabindex="8" size="40" maxlength="30" />
<span class="textfieldRequiredMsg"> a value is required.</span></span></td>
<td> </td>
</tr>
<tr>
<td><div align="right"></div></td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td><div align="right">* Course</div></td>
<td colspan="2"><span id="spryselect3">
<select name="courses" id="courses" tabindex="10" title="course">
<option value="0">Select</option>
<option value="Doctors">Doctors</option>
<option value="Nurse IP">Nurse IP</option>
<option value="Nurse OP">Nurse OP</option>
<option value="Midwife">Midwife</option>
<option value="HCA">HCA</option>
<option value="Pharmacist">Pharmacist</option>
<option value="Back Office Staff">Back Office Staff</option>
<option value="AHP">AHP</option>
<option value="Pi Help Desk Analyst">Pi Help Desk Analyst</option>
<option value="Medical Secretary">Medical Secretary</option>
<option value="OP Phlebotmist">OP Phlebotmist</option>
<option value="Champion Users Doctors">Champion Users Doctors</option>
<option value="Champion Users Nurse IP">Champion Users Nurse IP</option>
</select>
<span class="selectRequiredMsg">Please select an item.</span></span></td>
<td> </td>
</tr>
<tr>
<td><div align="right">* Training Location </div></td>
<td><span id="spryselect4">
<select name="troom" id="troom" tabindex="11" title="location">
<option value="0">Select</option>
<option value="CXH">Charing Cross</option>
<option value="HH">Hammersmith Hammersmith</option>
<option value="QEH">Queen Charlottee Hospital</option>
<option value="SMH">St Mary's Hospital</option>
<option value="WEH">Western Eye Hospital</option>
<option value="SCC">St Charles Community</option>
</select>
<span class="selectRequiredMsg">Please select an item.</span></span></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><div align="right">* CPG</div></td>
<td><span id="spryselect5">
<select name="cpg2" id="cpg2" tabindex="12" title="cpg">
<option value="0">Select</option>
<option value="CPG 1 Medicine">CPG1 - Medicine</option>
<option value="CPG 2 Surgery & Cancer">CPG2 - Surgery and Cancer</option>
<option value="CPG3 Specialist Services">CPG3 - Specialist Services</option>
<option value="CPG4 Circulatory Services and Renal Medicine">CPG4 - Circulatory Services and Renal Medicine</option>
<option value="CPG5 Womens and Childrens">CPG5 - Womens and Childrens</option>
<option value="CPG6 Clinical and Investigative Sciences">CPG6 - Clinical and Investigative Sciences</option>
<option value="CP7 Private Patients">CPG7 - Private Patients</option>
<option value="Others">Others</option>
</select>
<span class="selectRequiredMsg">Please select an item.</span></span></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="submitbt" id="submitbt" value="Submit" /></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td><div align="center">* Mandatory Fields</div></td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p> </p>
<p> </p>
<div class="footer">
<script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur", "change"]});
var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {validateOn:["blur", "change"]});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {validateOn:["blur", "change"]});
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "none", {validateOn:["blur", "change"]});
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "integer", {validateOn:["blur", "change"]});
var spryselect2 = new Spry.Widget.ValidationSelect("spryselect2", {invalidValue:"-1", isRequired:false, validateOn:["blur", "change"]});
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "none", {validateOn:["blur"]});
var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "none", {validateOn:["blur", "change"]});
var spryselect3 = new Spry.Widget.ValidationSelect("spryselect3");
var spryselect4 = new Spry.Widget.ValidationSelect("spryselect4");
var spryselect5 = new Spry.Widget.ValidationSelect("spryselect5", {validateOn:["blur", "change"]});
</script>
</div>
</div>
<p>
<a href="http://validator.w3.org/check?uri=referer"><img
src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>
</p>
<P></P>
</div>
</body>
</html>
<?php
mysql_free_result($rsattendance);
?>
Copy link to clipboard
Copied
>Some idiot got into your system and posted against each post I tried to post.
Our system? This is a user-to-user forum. We don't work for Adobe.
>Harressing me each post I make with the same replies.
The user had probably subscribed to this thread and had an autoreply email enabled. There was no intentional harassment.
Copy link to clipboard
Copied
So the page is now being redirected to ReportbyAll.php, but the rows are not being inserted? How are you verifying that? Is this a local testing server, or remote server?
Copy link to clipboard
Copied
Hi
I am closing this post as I have solved this and resolved this thru discussions.
Copy link to clipboard
Copied
>So shall I take out this block of code. This block of code is duplicate, right.
Yes, that's duplicated code, but I'm not sure which is the one you want to remove since they are not both exactly the same. Note that if you edit DW generated code, DW won't recognize it anymore so you can't use the behavior panels with it. If you try, DW will likely duplicate the code. There also seem to be a bug where DW will randomly duplicate code. Most of us here don't use DW server behaviors as the code is not very robust.
Copy link to clipboard
Copied
How should i do this from here? I am unclear how to do this change of thread. Would you be able to do it? Thanks