PHP在尝试创建多个表行时取消定义索引

PHP在尝试创建多个表行时取消定义索引,php,Php,以下程序在输入表单时计算一些输入。 我试图实现的是,当我返回表单输入新数据时,它会在表中添加一个新的表行 我一直在获取未定义索引,无法在表中获取多行。 注意:未定义索引:文件名 注意:未定义索引:大小 注意:未定义索引:楼层 注意:未定义索引:电话 注意:未定义索引:network 我的餐桌地址对吗 问候 文件1:expormulier.php <? Php session_start (); ?> <DOCTYPE html PUBLIC "- / / W3C / /

以下程序在输入表单时计算一些输入。
我试图实现的是,当我返回表单输入新数据时,它会在表中添加一个新的表行

我一直在获取未定义索引,无法在表中获取多行。 注意:未定义索引:文件名
注意:未定义索引:大小
注意:未定义索引:楼层
注意:未定义索引:电话
注意:未定义索引:network

我的餐桌地址对吗

问候

文件1:expormulier.php

<? Php 
session_start (); 
?> 

<DOCTYPE html PUBLIC "- / / W3C / / DTD XHTML 1.0 Strict / / EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 

<head> 
    <title> Expo Form </ title> 
<meta HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8" /> 
</ Head> 

<body> 

<? Php 

if (empty ($ _POST)) 
( 
    $ File name = $ _POST ['state name']; 
    $ Area = $ _POST ['size']; 
    $ Floor = isset ($ _POST ['floor'])? $ _POST ['Floor']: 0, / / if checkbox checked value 1 else 0 
    $ Phone = isset ($ _POST ['phone'])? $ _POST ['Phone']: 0; 
    $ Network = isset ($ _POST ['network'])? $ _POST ['Network']: 0; 

    / / Control surface 
    if (is_numeric ($ size)) / / OK 
    ( 
        if (isset ($ _SESSION ['table'])) 
        ( 
            / / Create a new row to the existing session table 
            $ Table = $ _SESSION ['table']; 
            $ Number = count ($ table); 
            $ Table [$ count] [0] = $ file name; 
            $ Table [$ count] [1] = $ size; 
            $ Table [$ count] [2] = $ floor; 
            $ Table [$ count] [3] = $ phone; 
            $ Table [$ count] [4] = $ network; 
            $ _SESSION ['Table'] = $ table; 
        ) 
        else 
        ( 
            / / Create the session table 
            $ Table [0] [0] = $ file name; 
            $ Table [0] [1] = $ size; 
            $ Table [0] [2] = $ floor; 
            $ Table [0] [3] = $ phone; 
            $ Table [0] [4] = $ network; 
            $ _SESSION ['Table'] = $ table; 
        ) 

            header ("Location: ExpoOverzicht.php"); 

    ) 
            else 
            ( 
                echo "Wrong <h1> area - New attempt </ h1>"; 
            ) 

) 

?> 

<Form action = "<? Php echo $ _SERVER ['PHP_SELF'];?>" Method = "post" id = "Form1"> 
    <h1> Enter details </ h1> 
    <table> 
        <tr> 
            <td> Stand Name: </ td> 
            <td> <input name="standnaam" size="18"/> </ td> 
        </ Tr> 
        <tr> 
            <td> Area (m ^ 2): </ td> 
            <td> <input name="oppervlakte" size="6"/> </ td> 
        </ Tr> 
        <tr> 
            <td> Floor: </ td> 
            <td> <input type="checkbox" name="verdieping" value="1"/> </ td> 
            <! - Value to set up a checkbox! is checked if value 1 -> 
        </ Tr> 
        <tr> 
            <td> Phone: </ td> 
            <td> <input type="checkbox" name="telefoon" value="1"/> </ td> 
        </ Tr> 
        <tr> 
            <td> Network: </ td> 
            <td> <input type="checkbox" name="netwerk" value="1"/> </ td> 
        </ Tr> 
        <tr> 
            <td> <input type="submit" name="verzenden" value="Verzenden"/> </ td> 
        </ Tr> 
    </ Table> 

</ Form> 


</ Body> 
</ Html>
<? Php 
session_start (); 
?> 

<DOCTYPE html PUBLIC "- / / W3C / / DTD XHTML 1.0 Strict / / EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 

<head> 
    <title> Expo Overview </ title> 
<meta HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8" /> 
    <link href="StyleSheetExpo.css" rel="stylesheet" type="text/css" /> 
</ Head> 

<body> 

<h1> List of stocks entered in this session </ h1> 

<? Php 

$ File name = $ _SESSION ['state name']; 
$ Size = $ _SESSION ['size']; 
$ Floor = $ _SESSION ['floor']; 
$ Telephone = $ _SESSION ['phone']; 
$ Network = $ _SESSION ['network']; 

$ Result1 = 0, / * each déclare else error "undefined variable" * / 
$ Result2 = 0; 
$ Result3 = 0; 
$ PrijsCom = 0; 
Floor price = $ 0; 

for ($ i = 1, $ i <= $ size, $ i + +) 
( 
    if ($ i <= 10), 
    ( 
       $ Tarief1 = 1 * 100; 
       $ Result1 + = $ tarief1; 
    ) 

    if ($ i> 10 & & $ i <= 30) 
    ( 
        $ Tarief2 = 1 * 90; 
        $ Result2 + = $ tarief2; 
    ) 

    if ($ i> 30) 
    ( 
        $ Tarief3 = 1 * 80; 
        $ Result3 + = $ tarief3; 
    ) 
) 
PrijsOpp $ result1 = $ + $ + $ result2 result3; 


if (floor == $ 1) 
( 
    Floor price = $ 120 * $ size; 
) 


if (($ phone == 1) | | ($ network == 1)) / / OR condition first read this or else the code uses only 20 
( 
    $ PrijsCom = 20; 
) 

if (($ phone == 1) & & ($ network == 1)) 
( 
    $ PrijsCom = 30; 
) 

Price $ total = $ price + $ prijsOpp Floor + $ prijsCom; 


$ Values = array ($ file name, $ size, $ floor, $ telephone, $ network, $ total Prize); 

echo "<table class=\"tableExpo\">; 

    echo "<th> State Name </ th>"; 
    echo "<th> Size </ th>"; 
    echo "<th> Floor </ th>"; 
    Echo '<th> Phone </ th> "; 
    echo "<th> Network </ th>"; 
    echo "<th> Total Price </ th>"; 

    / / For ($ i = 0, $ i <count ($ values); $ i + +) 
    / / ( 
        echo "<tr>; 
            echo "<td>. $ file name." </ td> "; 
            echo "<td>. $ surface." </ td> "; 
            echo "<td>. $ floor." </ td> "; 
            echo "<td>. $ telephone." </ td> "; 
            echo "<td>. $ network." </ td> "; 
            echo "<td>. $ total price." </ td> "; 
        echo "</ tr>"; 
    / /) 
echo "</ table>"; 

?> 

<a href="ExpoFormulier.php"> Back to form </ a> 

</ Body> 
</ Html>

博览会形式
世博会概况
本期会议登记的股票清单

当您从会话中读取时,表使用小写的t

$ Table = $ _SESSION ['table']; 
当您写回它时,表使用大写的T

$ _SESSION ['Table'] = $ table; 
他们是不同的

尝试使用
print\r($\u SESSION)之类的工具以帮助您调试此类问题

还有

您最初的if语句可能有错误的逻辑。这应该

if (empty ($ _POST)) 


你的意思是?我只是一个PHP初学者,如果你没有什么有用的东西可以添加,那就什么也不添加。
if (!empty ($ _POST))