Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
| Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 27th, 2004, 12:40 AM
Authorized User
 
Join Date: Apr 2004
Location: malacca, malacca, Malaysia.
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to junemo
Default 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">


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple forms one submit x_ray Classic ASP Basics 7 January 3rd, 2006 07:12 PM
cant submit forms rashmid PHP How-To 3 May 29th, 2005 04:34 PM
cant submit forms rashmid HTML Code Clinic 1 May 24th, 2005 05:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.