document.forms[0].submit()-not function??
hi, i hope somebody can help me solve this problem. when i write <a href="javascript: document.forms[0].submit()">Add</a> in my php project but why it can't display the info that i add before in the same form?
attach code:
<?php
#generating session and session id
session_start();
$sid = session_id();
include("html.php");
#dislaying HTML header
echo $head;
#unserializing data
$pos = unserialize($poss);
$stocka = unserialize($stocks);
$qtya = unserialize($qtys);
$uoma = unserialize($umos);
$pricea = unserialize($prices);
$amounta = unserialize($amounts);
#checking, if data has been pased to the form
if (strlen($invno) > 0)
{
$sinvno = $invno;
session_register("sinvno");
}
if ($newstock && ($newstock != ''))
{
$count++;
session_register("count");
$posa[$count] = $newpos;
$poss = serialize($posa);
session_register("poss");
$stocka[$count] = $newstock;
$stocks = serialize($stocka);
session_register("stocks");
$qtya[$count] = $newqty;
$qtys = serialize($qtya);
session_register("qtys");
$uoma[$count] = $newuom;
$uoms = serialize($uoma);
session_register("uoms");
$pricea[$count] = $newprice;
$prices = serialize($pricea);
session_register("prices");
$amounta[$count] = $newamount;
$amounts = serialize($amounta);
session_register("amounts");
}
# drawing the table
drawlines($count, $posa, $stocka, $qtya, $uoma, $pricea, $amounta);
# generate an input line
inputline();
# displaying end of HTML code
echo $tail;
# add lines containing data to the table
function drawlines($count, $posa, $stocka, $qtya, $uoma, $pricea, $amounta)
{
for ($i = 1; $i <= $count; $i++)
{
echo "<tr><td>$i</td><td>".$posa[$i]."</td>;
echo "<td>".$stocka[$i]."</td>";
echo "<td>".$qtya[$i]."</td><td>".$uoma[$i]."</td>";
echo "<td>".$pricea[$i]."</td>";
echo "<td>".$amounta[$i]."</td></tr>\n";
}
}
# edit the inputline to the data
function inputline()
{
echo '<tr><td>
<a href="javascript: document.forms[0].submit()">Add</a>
</td>
<td><input type="text" name="newpos" style="HEIGHT: 45px; WIDTH: 100px"></td>
<td><textarea name="newstock" style="HEIGHT: 60px; WIDTH: 415px">
|