PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 4th, 2012, 08:54 AM
clayraper clayraper is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 1 clayraper User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 16 sec
Reputation Power: 0
PHP4 - Scrolling header doesn't maintain value after POST

I have a page that when you browse to it, it pulls all the records in the database.. At the top of the page there is a floating form that allows you to scroll down the page and copy values from other cells into the table row that floats to the top of the page. In other words what you type into the text fields is blank when you submit it... However, if the row that floats remains at the very top of the page, the values are submitted correctly. PLEASE HELP


<html>
<head>
<title>WTSLocation Manager</title>

<script src=include/Table_Floating_header.js></script>

</head>
<body>



<?

$objConnect = mssql_connect("server","user","password");
$objDB = mssql_select_db("mockwtslocation");

//*** Add Condition ***//
if($_POST["hdnCmd"] == "Add")
{
$strSQL = "INSERT INTO Locations ";
$strSQL .="(ClientName,ClientMnemonic,MillEnvironment,Device_Location,Default_Printer,Powerchart_Printer,PCID) ";
$strSQL .="VALUES ";
$strSQL .="('".$_POST["txtAddClientName"]."','".$_POST["txtAddClientMnemonic"]."' ";
$strSQL .=",'".$_POST["txtAddMillEnvironment"]."' ";
$strSQL .=",'".$_POST["txtAddDevice_Location"]."','".$_POST["txtAddDefault_Printer"]."' ";
$strSQL .=",'".$_POST["txtAddPowerchart_Printer"]."' ";
$strSQL .=",'".$_POST["txtAddPCID"]."') ";
$objQuery = mssql_query($strSQL);
if(!$objQuery)
{
echo "Error Update [".mssql_error()."]";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}


?>

<?
// header( "refresh:120;url=wtslogin.php" );



//*** Update Condition ***//
if($_POST["hdnCmd"] == "Update")
{
$strSQL = "UPDATE Locations SET ";
$strSQL .="ClientName = '".$_POST["txtEditClientName"]."' ";
$strSQL .=",ClientMnemonic = '".$_POST["txtEditClientMnemonic"]."' ";
$strSQL .=",MillEnvironment = '".$_POST["txtEditMillEnvironment"]."' ";
$strSQL .=",Device_Location = '".$_POST["txtEditDevice_Location"]."' ";
$strSQL .=",Default_Printer = '".$_POST["txtEditDefault_Printer"]."' ";
$strSQL .=",Powerchart_Printer = '".$_POST["txtEditPowerchart_Printer"]."' ";
$strSQL .=",PCID = '".$_POST["txtEditPCID"]."' ";
$strSQL .="WHERE ClientName = '".$_POST["hdnEditClientName"]."' ";
$objQuery = mssql_query($strSQL);
if(!$objQuery)
{
echo "Error Update [".mssql_error()."]";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}

//*** Delete Condition ***//
if($_GET["Action"] == "Del")
{
$strSQL = "DELETE FROM Locations ";
$strSQL .="WHERE ClientName = '".$_GET["ClientName"]."' ";
$objQuery = mssql_query($strSQL);
if(!$objQuery)
{
echo "Error Delete [".mssql_error()."]";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}

$strSQL = "SELECT * FROM Locations ";
$objQuery = mssql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<form name="frmMain1" method="post" action="<?=$_SERVER["PHP_SELF"];?>">
<input type="hidden" name="hdnCmd" value="">
<table class="FloatTitle" width="600" border="1">


<thead>

<tr><td><div align="center">
<input type="text" name="txtAddClientName" size="20" style="background-color: #FFFF66" /></div></td>
<input type="hidden" name="txtAddClientMnemonic" size="15" value="MCCG_GA">
<input type="hidden" name="txtAddMillEnvironment" size="15" value="BMOCK">
<td align="center"><input type="text" name="txtAddClientMnemonic" size="20" style="background-color: #FFFF66;" value="MCCG_GA" disabled="disabled"></td>
<td align="center"><input type="text" name="txtAddMillEnvironment" size="20" style="background-color: #FFFF66" / value="BMOCK" disabled="disabled"></td>
<td align="center"><input type="text" value="Device Location..." onfocus="if(this.value=='Device Location...'){this.value=''}" onblur="if(this.value==''){this.value='Device Location...'}" name="txtAddDevice_Location" size="20" style="background-color: #FFFF66" /></td>
<td align="center"><input type="text" value="Default Printer..." onfocus="if(this.value=='Default Printer...'){this.value=''}" onblur="if(this.value==''){this.value='Default Printer...'}" name="txtAddDefault_Printer" size="20" style="background-color: #FFFF66" /></td>
<td align="center"><input type="text" value="Powerchart Printer..." onfocus="if(this.value=='Powerchart Printer...'){this.value=''}" onblur="if(this.value==''){this.value='Powerchart Printer...'}" name="txtAddPowerchart_Printer" size="20" style="background-color: #FFFF66" /></td>
<td align="center"><input type="text" value="PCID..." onfocus="if(this.value=='PCID...'){this.value=''}" onblur="if(this.value==''){this.value='PCID...'}" name="txtAddPCID" style="background-color: #FFFF66" /></td>
<td colspan="2" align="right"><div align="center">
<input name="btnAdd" type="button" style="padding: 5px 20px;" id="btnAdd" value="Add" OnClick="frmMain1.hdnCmd.value='Add';frmMain1.submit();"></div></td>
<td><input type="button" style="padding: 5px 20px;" value="Logout" onClick="window.location.href='logout.php'">
</thead>
</td></tr>









<tr>
<!-- <th width="200"> <div align="center">Copy </div></th> -->


<th width="200"> <div align="center">Client Name </div></th>
<th width="98"> <div align="center">Client Mnemonic </div></th>
<th width="198"> <div align="center">Mill Environment </div></th>
<th width="97"> <div align="center">Device Location </div></th>
<th width="59"> <div align="center">Default Printer </div></th>
<th width="59"> <div align="center">Powerchart Printer </div></th>
<th width="71"> <div align="center">PCID </div></th>
<th width="30"> <div align="center">Edit </div></th>
<th width="30"> <div align="center">Delete </div></th>
</tr>






<?
while($objResult = mssql_fetch_array($objQuery))
{
if($objResult["ClientName"] == $_GET["ClientName"] and $_GET["Action"] == "Edit")
{
?>
<tr>
<td><div align="center">
<input type="text" name="txtEditClientName" size="20" value="<?=$objResult["ClientName"];?>">
<input type="hidden" name="hdnEditClientName" size="20" value="<?=$objResult["ClientName"];?>">
</div></td>
<td><input type="text" name="txtEditClientMnemonic" size="20" value="<?=$objResult["ClientMnemonic"];?>"></td>
<td><input type="text" name="txtEditMillEnvironment" size="20" value="<?=$objResult["MillEnvironment"];?>"></td>
<td><div align="center"><input type="text" name="txtEditDevice_Location" size="20" value="<?=$objResult["Device_Location"];?>"></div></td>
<td align="right"><input type="text" name="txtEditDefault_Printer" size="20" value="<?=$objResult["Default_Printer"];?>"></td>
<td align="right"><input type="text" name="txtEditPowerchart_Printer" size="20" value="<?=$objResult["Powerchart_Printer"];?>"></td>
<td align="right"><input type="text" name="txtEditPCID" size="20" value="<?=$objResult["PCID"];?>"></td>

<td colspan="2" align="right"><div align="center">
<input name="btnAdd" type="button" id="btnUpdate" value="Update" OnClick="frmMain1.hdnCmd.value='Update';frmMain1.submit();">
<input name="btnAdd" type="button" id="btnCancel" value="Cancel" OnClick="window.location='<?=$_SERVER["PHP_SELF"];?>';">
</div></td>
</tr>
<?
}
else
{
?>

<tr>

<td><div align="center"><input type=text id=cpyname name=cpyname disabled="disabled" value="<?=$objResult["ClientName"];?>"</div></td>
<td><input type=text id=cpymne name=cpymne disabled="disabled" value="<?=$objResult["ClientMnemonic"];?>"</td>
<td><input type=text id=cpymill name=cpymill disabled="disabled" value="<?=$objResult["MillEnvironment"];?>"</td>
<td><input type=text id=cpyloc name=cpyloc disabled="disabled" value="<?=$objResult["Device_Location"];?>"</div></td>
<td align="right"><input type=text id=cpydpr name=cpydpr disabled="disabled" value="<?=$objResult["Default_Printer"];?>"</td>
<td align="right"><input type=text id=cpypcp name=cpypcp disabled="disabled" value="<?=$objResult["Powerchart_Printer"];?>"</td>
<td align="right"><input type=text id=cpypcid name=cpypcid disabled="disabled" value="<?=$objResult["PCID"];?>"</td>
<td align="center"><a href="<?=$_SERVER["PHP_SELF"];?>?Action=Edit&ClientName=<?=$objResult["ClientName"];?>">Edit</a></td>
<td align="center"><a href="javascript:if(confirm('Confirm Delete?')==true){window.location='<?=$_SERVER["PHP_SELF"];?>?Action=Del&ClientName=<?=$objResult["ClientName"];?>';}">Delete</a></td>
</tr>
<?
}
?>
<?
}
?>

</table>
</form>
<?
mssql_close($objConnect);
?>
</body>
</html>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP4 - Scrolling header doesn't maintain value after POST

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap