douzhannao5357 2011-10-22 16:45
浏览 14

未提交Php / sql表单的人口值

Hi have a quick question. Currently I am filling a form with data from a sql query. So for instance they select item number two and the form is filled with the data for item 2 from the data base. I then wish to be able be able to press my update button and have the data that is in the form submitted so that if it is changed in the form it changes in the data base. for example:

  • item 1 is selected from the drop down list
  • enter is pressed
  • the page is refreshed and the form is populated with the data from the sql statement in the first submit
  • ^^^ this works

I know have the info in the form and want to be able to hit the ubdate button so the old data is passed or type in in values and sub it. The problem is the variables and data that are stored in the form are not passed

Here is the page source

enter code here


<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
    <link rel="stylesheet" href="css/main.css" type="text/css" />
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
    <title>Inventory</title>

</head>
<body>

<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
    <link rel="stylesheet" href="css/headercss.css" type="text/css" />
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
    <title>Inventory</title>

</head>
<body>

<div id="navigation">
        <ul>
            <li>
            <a href="">Total Inventory</a>
               <ul>
                <li><a href="TotalInventory.php">Total Inventory</a></li>
                <li><a href="NewItem.php">Add new Item</a></li>
                <li><a href="SpecificItem.php">View Specific Item</a></li>

                <li><a href="UpdateItem.php">Update Item</a></li>
            </ul>
            </li>

            <li>
            <a href="">House Inventory</a>
               <ul>
                <li><a href="#">House Inventory</a></li>

                <li><a href="#">Add new Item</a></li>

            </ul>
            </li>


        </ul>
    </div>

</body> <br />
    <form id="addItem" action="/workspace/iventory2/UpdateItem.php" method="post" >

        <select name="items" id="items">

        <option value"sdgssr5y">sdgssr5y</option><option value"a">a</option><option value"sf">sf</option><option value"gsh">gsh</option><option value"cat">cat</option><option value""></option><option value"afdsf">afdsf</option><option value"15">15</option><option value"zzz">zzz</option><option value"nnn">nnn</option><option value"dsdsgfsg">dsdsgfsg</option>     </select>
        <input class="submit" type="submit" value="Enter" name="submit"/>

        <input class="update" type="submit" value="update" name="update"/>      
    </form>
    <form method="post">
        <br />


    <form id="addItem" action="/workspace/iventory2/UpdateItem.php" method="post" autocomplete="off" >

        <label>Item Name: <input name="ItemName" id="ItemName" value="15"/></label><label>CostPrice: <input name="CostPrice"id="CostPrice"value="10"/></label><label>CurrentLevel:<input name="CurrentLevel"id="CurrentLevel"value="10"/></label>   


        <input class="submit" type="submit" value="Enter" name="submit"/>   
    </form>

    <form method="post">

</body>
  • 写回答

2条回答 默认 最新

  • dpd3447 2011-10-22 16:52
    关注

    Misread the post, sorry. Re-evaluating...

    2 Suggestions to try, one is for coding practice, if possible dont use text as the WHERE, assign an ID and pass that instead. You have to take into account case, etc if you use text.

    In your HTML, add spaces. name="CurrentLevel"id="CurrentLevel"value=""

    评论

报告相同问题?

悬赏问题

  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比