0

$disply_storage变量具有值列表,现在我想在 php myfunction() 中调用 storage_facility_id 我无法理解如何在 myfunction() 中获取 storage_facility_id 值

  <?php
            function myfunction(){
            $x=$_POST['storage_facility_id'];
            }
            ?>
            <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/html4/loose.dtd">
            <html>
            <head>

     <?php include('include/admin-header.php');
            $disply_storage=edit_storage_facility();
          ?>
            <script language="javascript" type="text/javascript">
            function ILovePHP() {
            b = "<?=myfunction();?>";
            alert(b);
            }
            </script>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
            <title>Untitled Document</title>
            </head>
            <body>
            <form action="" method="post">
            <?php  
                          for ($i = 0 ;$i<count($disply_storage);$i++){?> 
                          <tr class="light-gray-bg">
                             <td align="center"><?php echo $disply_storage[$i]['add_facility_name'];?></td>
                             <td align="center"><a href="storage_mapping.php?id=<?php echo $disply_storage[$i]['storage_facility_id'];?>"><img src="images/edit.png" border="0" /></td>
                            <td align="center"><a onClick="javascript:return confirm_delete()" href="delete_facility.php?id=<?php echo $disply_storage[$i]['storage_facility_id'];?>"><img src="images/delete.png" border="0" /></td>

                            <td><a href="javascript:ChangeStatus(<?php echo $disply_storage[$i]['storage_facility_id'];?>)" title="<?=($rec['is_active']==1)?'Turn off':'Turn on'?>">
                <?=($disply_storage[$i]['is_active']==1)?'<img src="images/active.gif" border="0">':'<img src="images/inactive.gif" border="0">'?>
                </a></td>
                        </tr>
                <?php }?>
                </form><p>
            </body>
            </html>
4

1 回答 1

1

我真的不明白你在这里做什么,但我会试一试。

首先, myfunction 几乎什么都不做。我猜你想要...

function myfunction(){
    return $_POST['storage_facility_id'];
}

这对我来说毫无意义,因为您可以随时回显 $_POST var inline。然而,数据只会出现在页面发布到的地方。

于 2013-08-07T15:38:54.203 回答