OK.. I have this following script which draws info from a table, and populates a drop down box.
I need to add a value "txtEgroup" to pass to the file in the action "update_purchase.php?typ=new".
The value for txtEgroup is derived from the table exp_item field exp_group.
Hope this makes sense.. this might just be a mod to the javascript "putPrice".. or not..
Any suggestions?
As always, thanks for any help you can give this "newbie
I need to add a value "txtEgroup" to pass to the file in the action "update_purchase.php?typ=new".
The value for txtEgroup is derived from the table exp_item field exp_group.
Hope this makes sense.. this might just be a mod to the javascript "putPrice".. or not..
Any suggestions?
Code:
<html>
<head>
<title>Enter Purchases</title>
<script language="JavaScript">
function validate(m)
{
var ename=document.frmExpense.expName.value;
var dt = new Date(document.frmExpense.txtDate.value);
if(document.frmExpense.expName.value=="")
{
alert("Enter Purchase Name");
document.frmExpense.ename.focus();
return false;
}
else if(document.frmExpense.amount.value=="")
{
alert("Enter Purchase Amount");
document.frmExpense.amount.focus();
return false;
}
else if(document.frmExpense.txtDate.value=="")
{
alert("Enter Date");
document.frmExpense.txtDate.focus();
return false;
}
else
return true;
}
</script>
<!--Numeric Validation-->
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\-\_\{\}\`\~\=\|\!\abcdefghijklmnopqrstuvwxyz\ABCDEFGHIJKLMNOPQRSTUVWXYZ]/;
function OnlyNumeric(val) {
var strPass = val.value;
var strLength = strPass.length;
var i;
for(i=0;i<strLength;i++)
{
var lchar = strPass.charAt(i);
if(lchar.search(mikExp) != -1)
{
val.value='';
break;
}
}
}
// End -->
</script>
<SCRIPT language=javascript src="scripts/calendar.js"></SCRIPT>
<link rel="stylesheet" href="scripts/surylake.css" media="screen"></LINK>
<!--Afdd (/)Date-->
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\|\!\-\abcdefghijklmnopqrstuvwxyz\ABCDEFGHIJKLMNOPQRSTUVWXYZ]/;
function dodacheck(val) {
var strPass = val.value;
var strLength = strPass.length;
var lchar = val.value.charAt((strLength) - 1);
if(lchar.search(mikExp) != -1) {
var tst = val.value.substring(0, (strLength) - 1);
val.value = tst;
}
if (strLength==2){
val.value = val.value + '/'
}
if (strLength==5){
val.value = val.value + '/'
}
}
// End -->
function putPrice(m)
{
document.frmExpense.amount.value=m.value;
var i;
for(i=0;i<m.length;i++)
{
if(m.options(i).selected==true)
document.frmExpense.txtExpname.value=m.options(i).text;
}
}
</script>
<!--Afdd (/) Date-->
</head>
<body bgcolor="#47A0F9">
<?php
include("conobj.php");
$query="select exp_name,exp_price,exp_group from exp_item order by exp_name";
$result=mysql_query($query,$db_connection);
include("header.php");
?>
<center>
<TABLE class=main cellSpacing=0 cellPadding=5 width="100%" align=center>
<TBODY>
<TR>
<TD vAlign=top>
<CENTER class=main><B>Enter Purchase</B></CENTER><BR>
<FORM action=update_purchase.php?typ=new method=post name=frmExpense onsubmit=return validate(this)>
<input type=hidden name='r_id' value='<?php print $id; ?>'>
<TABLE class=main cellSpacing=1 cellPadding=5
align=center bgColor=#000000>
<TBODY>
<?php
if($upd=='Y')
print("<tr bgColor=#ffffff><td colspan=4 align=center>Last Purchase Updated</td></tr>");
?>
<TR bgColor=#ffffff>
<TD class=main align=right><B>Purchase:</B></TD>
<TD>
<select name=expName onclick="putPrice(this);">
<?php
print ("<OPTION value=0>Item</OPTION>");
while ($row=mysql_fetch_object($result))
{
print"<option value=".$row->exp_price .">".$row->exp_name ."</option>";
}
?>
</select>
<!--INPUT class=search maxLength=32
name=ename-->*</TD>
<TD class=main align=right><B>Amount:</B></TD>
<TD>$ <INPUT class=search maxLength=8 size=8
name=amount onKeyUp="OnlyNumeric(this);">*
<input type=hidden name=txtExpname></TD></TR>
<TR bgColor=#ffffff>
<TD class=main align=right><B>Entered:</B></TD>
<? $td=date("Y-m-d");
$egroup="$row->exp_group";
?>
<td> <INPUT onFocus="" value=<?php Print"$td"; ?> name=txtDate maxlength=10 size=10><input name=txtEgroup type=text value=<?php print "$egroup"; ?>>
</td>
<td class=main align=right><b>Quantity:</b></td>
<td align=right><select name="quantity" size="1">
<option value="1" selected>1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select> </td>
</TR>
</TBODY></TABLE><BR>
<CENTER><INPUT class=button type=submit value="Enter Purchase >>" name=submit>
</FORM></TD></TR></table>
As always, thanks for any help you can give this "newbie