Forum Moderators: coopster
<head>
<script language="javascript">
//some functions herefunction addButtonUp_onclick() {
NewDataForm.addButtonUp.disabled = true;
s = "NewData1209.php?tempDateValue="+NewDataForm.DateLog.value+ "&tempProjValue="+NewDataForm.NewPrjSelect.value+"&tempPrjCodeValue="+ NewDataForm.PrjCode.value+"&tempMapNumberValue="+ NewDataForm.MapNumber.value+"&tempDivisionValue="+ NewDataForm.Division.value+"&tempActValue="+ NewDataForm.NewActivityNameSelect.value+"&tempActCodeValue="+ NewDataForm.NewActivityNameSelect.value+"&tempMedValue="+ NewDataForm.NewMediumNameSelect.value+"&tempMedCodeValue="+ NewDataForm.MediumCodeBox.value+"&addButtonUpTemp="+ NewDataForm.addButtonUp.value+"&tempTotalRegValue="+ NewDataForm.TotalRegHrsBox.value+"&tempTotalOtValue="+ NewDataForm.TotalOtHrsBox.value+"&tempPStatusValue="+ NewDataForm.PStatusBox.value+"&tempRegValue="+ NewDataForm.RegHrsBox.value+"&tempOtValue="+NewDataForm.OtHrsBox.value+"";
window.open(s,"dataview");
}
</script>
</head>
<body>
<form name="NewData1209.php" method="POST">
<?
//hidden fields containing the inputed data
//if statements if the user filled up all the data then it will insert$DBConn=mysql_connect("localhost","root");
mysql_select_db("TEST",$DBConn);
$SQLString="select * from StatusTable";
$rs=mysql_query($SQLString);
$SQLString="INSERT INTO StatusTable (ActDate,PIN,PrjCode,MapNumber";
$SQLString=$SQLString."ActCode,MediumCode,RegHrs,OTHrs,PStatus,P_id,DataFiled) VALUES ";
$SQLString=$SQLString."('".$_POST["tempDateValue"]."',";
$SQLString=$SQLString." '".$tempUserNameNew2."',";
$SQLString=$SQLString." '".$_POST["tempPrjCodeValue"]."',";
$SQLString=$SQLString." '".$_POST["tempMapNumberValue"]."',";
$SQLString=$SQLString." '".$_POST["tempActCodeValue"]."',";
$SQLString=$SQLString." '".$_POST["tempMedCodeValue"]."',";
$SQLString=$SQLString." '".round($_POST["tempTotalRegValue"],2)."',";
$SQLString=$SQLString." '".round($_POST["tempTotalOtValue"],2)."',";
$SQLString=$SQLString." '".round($_POST["tempPStatusValue"],2)."',";
$SQLString=$SQLString." '".$_SESSION['username']."',";
$SQLString=$SQLString." '".$dateToday."')";
$NewDataToggle="Added";
?>
<script language="javascript">
<!--
if (NewDataForm.AddDataToggleNew.value == "Added")
{
alert("DATA ADDED SUCCESSFULLY!")
document.NewDataForm.submit()
}
-->
</script><input class=button style="width:100%" type="button" value="ADD" id="addButtonUp" name="addButtonUp" title="Add Record" onclick="return addButtonUp_onclick()">
</body>
[edited by: jatar_k at 9:18 pm (utc) on Dec. 10, 2004]
[edit reason] fixed sidescroll [/edit]
i tried to change my code this way
$DBConn=mysql_connect("localhost","root");
mysql_select_db("TEST",$DBConn);
$SQLString="INSERT INTO StatusTable (ActDate,PIN,PrjCode,MapNumber" ...
$rs=mysql_query($SQLString);
$NewDataToggle="Added";
and when i press the add button it refreshes the page but the data are not yet inserted into my database.