duanhongxian6982 2013-08-07 13:16
浏览 22

在同一页面上的php函数中传递href值

$disply_storage variable has list of value, now what i want call storage_facility_id in php myfunction() i cant understand how to get storage_facility_id values in myfunction()

  <?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>
  • 写回答

1条回答 默认 最新

  • doushi4956 2013-08-07 15:38
    关注

    I really don't get what you are doing here but I will take a stab at it.

    First off, myfunction pretty much does nothing. I guess you want...

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

    which makes to no sense to me as you can just echo the $_POST var inline any time. However the data is only going to be there the page was posted to.

    评论

报告相同问题?

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥15 Oracle触发器记录修改前后的字段值
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题