aot2002
asked on
$_SESSION number 1 is lost somehow when i go to add the third item to the invoice ?
$_SESSION
number 1 is lost somehow when i go to add the third item to the invoice ?
function additem(){
if($_SESSION['totalitems'] > 0){
$totalitems = $_SESSION['totalitems'] + 1;
$_SESSION['totalitems'] = $totalitems; //keep track of total items
$_SESSION['qty'.$totalitem s] = $_REQUEST['qty'];
$_SESSION['interchangenumb er'.$total items] = $_REQUEST['interchangenumb er'];
$_SESSION['interchangeid'. $totalitem s] = $_REQUEST['interchangeid'] ;
$_SESSION['description'.$t otalitems] = $_REQUEST['description'];
$_SESSION['rate'.$totalite ms] = $_REQUEST['rate'];
$_SESSION['amount'.$totali tems] = $_REQUEST['amount'];
$_SESSION['taxable'.$total items] = $_REQUEST['taxable'];
$_SESSION['notes'.$totalit ems] = $_REQUEST['notes'];
$_SESSION['partid'.$totali tems] = $_REQUEST['partid'];
}else{
//add first item SO use the 1 after each item
$_SESSION['qty1'] = $_REQUEST['qty'];
$_SESSION['interchangenumb er1'] = $_REQUEST['interchangenumb er'];
$_SESSION['interchangeid1' ] = $_REQUEST['interchangeid'] ;
$_SESSION['description1'] = $_REQUEST['description'];
$_SESSION['rate1'] = $_REQUEST['rate'];
$_SESSION['amount1'] = $_REQUEST['amount'];
$_SESSION['taxable1'] = $_REQUEST['taxable'];
$_SESSION['notes1'] = $_REQUEST['notes'];
$_SESSION['partid1'] = $_REQUEST['partid'];
$_SESSION['tracking1'] = $_REQUEST['tracking'];
$_SESSION['vendorid1'] = $_REQUEST['vendorid'];
$_SESSION['totalitems'] = 1;
}
}
function showallitems(){
$items = $_SESSION['totalitems'] + 1;
for($a=1; $a < $items; $a++){
$totalitems = $a;
echo '
<form name="remove'.$totalitems. '" action="" method="post">
<table width="73%" border="1" cellspacing="0" cellpadding="0" bordercolor="#000066">
<tr bgcolor="#99CCFF" bordercolor="#000066">
<td width="10%" align="center" valign="center" true styleid="StyleQty" bgcolor="#990000" bordercolor="#FFFFFF"><fon t color="#FFFFFF">Hidden</fo nt></td>
<td width="10%" align="center" valign="center" true styleid="StyleQty"><font face="Verdana" size="-1" color="#000000">Quantity</ font></td>
<td width="10%" align="center" valign="center" true styleid="StyleQty">PartID< /td>
<td width="14%" align="center" valign="center" true styleid="StyleQty">Interch ange
# </td>
<td width="37%" align="center" valign="center" true styleid="StyleItemDesc">
<font face="Verdana" size="-1" color="#000000">Descriptio n</font> </td>
<td width="8%" align="center" valign="center" true styleid="StyleRate"> <font face="Verdana" size="-1" color="#000000">Rate</font >
</td>
<td width="6%" align="center" valign="center" true styleid="StyleItemAmount">
<font face="Verdana" size="-1" color="#000000">Amount</fo nt> </td>
<td width="15%" align="center" valign="center" true styleid="StyleTaxFlag">
<font face="Verdana" size="-1" color="#000000">Tax < /font> </td>
</tr>
<tr bgcolor="#99CCFF" bordercolor="#000066">
<td width="10%" align="center" valign="center" true styleid="StyleQty" bgcolor="#990000" bordercolor="#FFFFFF" height="13">
</td>
<td width="10%" align="center" valign="center" true styleid="StyleQty" height="13">
<input type="text" name="qty'.$totalitems.'" size="4" maxlength="3" value="'.$_SESSION['qty'.$ totalitems ].'" readonly>
</td>
<td width="10%" align="center" valign="center" true styleid="StyleQty" height="13">
<input type="text" name="interchangeid'.$tota litems.'" value="'.$_SESSION['interc hangeid'.$ totalitems ].'" size="9" readonly>
<br>
</td>
<td width="14%" align="center" valign="center" true styleid="StyleQty" height="13"><font face="Verdana" size="-1" color="#000000">
<input type="text" name="interchangenumber'.$ totalitems .'" value="'.$_SESSION['interc hangenumbe r'.$totali tems].'" size="13" readonly>
</font></td>
<td width="37%" align="center" valign="center" true styleid="StyleItemDesc" height="13"><font face="Verdana" size="-1" color="#000000">
<input type="text" name="description'.$totali tems.'" size="45" value="'.$_SESSION['descri ption'.$to talitems]. '" readonly>
</font></td>
<td width="8%" align="center" valign="center" true styleid="StyleRate" height="13"><font face="Verdana" size="-1" color="#000000">
<input type="text" name="rate'.$totalitems.'" size="8" value="'.$_SESSION['rate'. $totalitem s].'" readonly>
</font></td>
<td width="6%" align="center" valign="center" true styleid="StyleItemAmount" height="13"><font face="Verdana" size="-1" color="#000000">
<input type="text" name="amount'.$totalitems. '" size="7" value="'.$_SESSION['amount '.$totalit ems].'" readonly>
</font></td>
<td width="15%" align="center" valign="center" true styleid="StyleTaxFlag" height="13">NT</td>
</tr>
</table>
<table width="73%" border="1" cellspacing="0" cellpadding="0" bordercolor="#000066">
<tr>
<td bgcolor="#990000" width="29%">
<div align="center"><font color="#FFFFFF">Hidden Notes about Item</font></div>
</td>
<td bgcolor="#990000" width="38%">
<div align="center"><font color="#FFFFFF">Hidden Vendor & Tracking</font></div>
</td>
<td bgcolor="#990000" width="33%">
<div align="center"><font color="#FFFFFF">Misc</font ></div>
</td>
</tr>
<tr>
<td bgcolor="#990000" width="29%">
<textarea name="notes'.$totalitems.' " cols="50" rows="5" readonly>'.$_SESSION['note s'.$totali tems].'</t extarea>
</td>
<td bgcolor="#990000" width="38%">
<p><font color="#FFFFFF">Tracking # </font>
<input type="text" name="tracking'.$totalitem s.'" value="'.$_SESSION['tracki ng'.$total items].'" readonly>
</p>
<p><font color="#FFFFFF">Vendorid #
<input type="text" name="vendorid'.$totalitem s.'" value="'.$_SESSION['vendor id'.$total items].'" readonly>
</font></p>
</td>
<td bgcolor="#990000" width="33%">
<input type="hidden" name="removeitem" value="true">
<input type="hidden" name="removeid" value='.$totalitems.'>
<input type="submit" name="removeitem'.$totalit ems.'" value="Remove Item">
</td>
</tr>
</table>
</form>
';
}
}
number 1 is lost somehow when i go to add the third item to the invoice ?
function additem(){
if($_SESSION['totalitems']
$totalitems = $_SESSION['totalitems'] + 1;
$_SESSION['totalitems'] = $totalitems; //keep track of total items
$_SESSION['qty'.$totalitem
$_SESSION['interchangenumb
$_SESSION['interchangeid'.
$_SESSION['description'.$t
$_SESSION['rate'.$totalite
$_SESSION['amount'.$totali
$_SESSION['taxable'.$total
$_SESSION['notes'.$totalit
$_SESSION['partid'.$totali
}else{
//add first item SO use the 1 after each item
$_SESSION['qty1'] = $_REQUEST['qty'];
$_SESSION['interchangenumb
$_SESSION['interchangeid1'
$_SESSION['description1'] = $_REQUEST['description'];
$_SESSION['rate1'] = $_REQUEST['rate'];
$_SESSION['amount1'] = $_REQUEST['amount'];
$_SESSION['taxable1'] = $_REQUEST['taxable'];
$_SESSION['notes1'] = $_REQUEST['notes'];
$_SESSION['partid1'] = $_REQUEST['partid'];
$_SESSION['tracking1'] = $_REQUEST['tracking'];
$_SESSION['vendorid1'] = $_REQUEST['vendorid'];
$_SESSION['totalitems'] = 1;
}
}
function showallitems(){
$items = $_SESSION['totalitems'] + 1;
for($a=1; $a < $items; $a++){
$totalitems = $a;
echo '
<form name="remove'.$totalitems.
<table width="73%" border="1" cellspacing="0" cellpadding="0" bordercolor="#000066">
<tr bgcolor="#99CCFF" bordercolor="#000066">
<td width="10%" align="center" valign="center" true styleid="StyleQty" bgcolor="#990000" bordercolor="#FFFFFF"><fon
<td width="10%" align="center" valign="center" true styleid="StyleQty"><font face="Verdana" size="-1" color="#000000">Quantity</
<td width="10%" align="center" valign="center" true styleid="StyleQty">PartID<
<td width="14%" align="center" valign="center" true styleid="StyleQty">Interch
# </td>
<td width="37%" align="center" valign="center" true styleid="StyleItemDesc">
<font face="Verdana" size="-1" color="#000000">Descriptio
<td width="8%" align="center" valign="center" true styleid="StyleRate"> <font face="Verdana" size="-1" color="#000000">Rate</font
</td>
<td width="6%" align="center" valign="center" true styleid="StyleItemAmount">
<font face="Verdana" size="-1" color="#000000">Amount</fo
<td width="15%" align="center" valign="center" true styleid="StyleTaxFlag">
<font face="Verdana" size="-1" color="#000000">Tax <
</tr>
<tr bgcolor="#99CCFF" bordercolor="#000066">
<td width="10%" align="center" valign="center" true styleid="StyleQty" bgcolor="#990000" bordercolor="#FFFFFF" height="13">
</td>
<td width="10%" align="center" valign="center" true styleid="StyleQty" height="13">
<input type="text" name="qty'.$totalitems.'" size="4" maxlength="3" value="'.$_SESSION['qty'.$
</td>
<td width="10%" align="center" valign="center" true styleid="StyleQty" height="13">
<input type="text" name="interchangeid'.$tota
<br>
</td>
<td width="14%" align="center" valign="center" true styleid="StyleQty" height="13"><font face="Verdana" size="-1" color="#000000">
<input type="text" name="interchangenumber'.$
</font></td>
<td width="37%" align="center" valign="center" true styleid="StyleItemDesc" height="13"><font face="Verdana" size="-1" color="#000000">
<input type="text" name="description'.$totali
</font></td>
<td width="8%" align="center" valign="center" true styleid="StyleRate" height="13"><font face="Verdana" size="-1" color="#000000">
<input type="text" name="rate'.$totalitems.'"
</font></td>
<td width="6%" align="center" valign="center" true styleid="StyleItemAmount" height="13"><font face="Verdana" size="-1" color="#000000">
<input type="text" name="amount'.$totalitems.
</font></td>
<td width="15%" align="center" valign="center" true styleid="StyleTaxFlag" height="13">NT</td>
</tr>
</table>
<table width="73%" border="1" cellspacing="0" cellpadding="0" bordercolor="#000066">
<tr>
<td bgcolor="#990000" width="29%">
<div align="center"><font color="#FFFFFF">Hidden Notes about Item</font></div>
</td>
<td bgcolor="#990000" width="38%">
<div align="center"><font color="#FFFFFF">Hidden Vendor & Tracking</font></div>
</td>
<td bgcolor="#990000" width="33%">
<div align="center"><font color="#FFFFFF">Misc</font
</td>
</tr>
<tr>
<td bgcolor="#990000" width="29%">
<textarea name="notes'.$totalitems.'
</td>
<td bgcolor="#990000" width="38%">
<p><font color="#FFFFFF">Tracking # </font>
<input type="text" name="tracking'.$totalitem
</p>
<p><font color="#FFFFFF">Vendorid #
<input type="text" name="vendorid'.$totalitem
</font></p>
</td>
<td bgcolor="#990000" width="33%">
<input type="hidden" name="removeitem" value="true">
<input type="hidden" name="removeid" value='.$totalitems.'>
<input type="submit" name="removeitem'.$totalit
</td>
</tr>
</table>
</form>
';
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.