Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP 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
 
Old April 26th, 2004, 04:23 AM
Authorized User
 
Join Date: Apr 2004
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to junemo
Default add/edit the inputline to the data

hi, I want design the dynamic document so I add lines containing data to the table. But, when i want run it, output doesn't appear! the code to edit the inputlines to the data, i refer from a book-javasricpt,but i don't know what this code function and where is store my data?
<a href="javascript:document.forms[0].submit()">Add</a>
how i want create and connect to the dbase use MySQL with this pages?
attach code:

<?php

    #generating session and session id

    session_start();
    $sid = session_id();

    include("html.php");

    #dislaying HTML header

    echo $head;

    #unserializing data

    $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($bill) > 0)
    {
        $sbill = $bill;
        session_register("sbill");
    }

    if (strlen($ship) > 0)
    {
        $sship = $ship;
        session_register("sship");
    }

    if (strlen($invno) > 0)
    {
        $sinvno = $invno;
        session_register("sinvno");
    }

    if ($newstock && ($newstock != ''))
    {
        $count++;
        session_register("count");

        $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, $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, $stocka, $qtya, $uoma, $pricea, $amounta)
    {
        for ($i = 1; $i <= $count; $i++)
        {
            echo "<tr><td>$i</td><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><textarea name="newstock" style="HEIGHT: 60px; WIDTH: 415px"></TEXTAREA></td>
            <td><input type="text" name="newqty" style="HEIGHT: 50px; WIDTH: 150px"></td>
            <td><input type="text" name="newuom" style="HEIGHT: 50px; WIDTH: 150px"</td>
            <td><input type="text" name="newsprice" style="HEIGHT: 50px; WIDTH: 150px"</td>
            <td><input type="text" name="newsamount" style="HEIGHT: 50px; WIDTH: 150px"></td>
        ';
    }
?>

thanks a lot






Similar Threads
Thread Thread Starter Forum Replies Last Post
Tabs + Subforms + Add/Edit = No Go hkmulligan Access 5 August 10th, 2007 06:54 AM
Edit/Add/Delete within a DataGrid ozzy VB.NET 2002/2003 Basics 5 January 23rd, 2005 01:17 AM
how to know who edit or add records? drachx General .NET 1 October 13th, 2004 05:36 AM
how to know who edit add records? drachx SQL Server 2000 9 October 13th, 2004 04:28 AM
Given the datalist. How do I add edit mode? macupryk General .NET 0 October 8th, 2004 12:29 PM





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