Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/249.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript PHP-如何从input type hidden和$\ POST中获取名称到另一个PHP?_Javascript_Php_Jquery_Html_Google Maps - Fatal编程技术网

Javascript PHP-如何从input type hidden和$\ POST中获取名称到另一个PHP?

Javascript PHP-如何从input type hidden和$\ POST中获取名称到另一个PHP?,javascript,php,jquery,html,google-maps,Javascript,Php,Jquery,Html,Google Maps,我希望可以将getvenueurl的值传递给另一个名为map.php的php 我使用“隐藏输入类型”在当前页面中回显: <?php $read_venue = mysql_query("select * from venue where theme_name = '$title'"); while($show_venue = mysql_fetch_array($read_venue)) { ?> <form method="post" action="#tab5"&g

我希望可以将
getvenueurl
的值传递给另一个名为map.php的php

我使用“隐藏输入类型”在当前页面中回显:

 <?php
$read_venue = mysql_query("select * from venue where theme_name = '$title'");

while($show_venue = mysql_fetch_array($read_venue)) 
{

?>
<form method="post" action="#tab5">
<center><table border="1" class="venuetb">

    <tr>
        <input type="hidden" name="getvenue" value="<?php echo $show_venue['venue']; ?>"/>
        <input type="hidden" name="getvenueprice" value="<?php echo $show_venue['price']; ?>"/>
        <input type="hidden" name="getvenueurl" value="<?php echo $show_venue['url']; ?>"/>

        <td style="width:20%;"><center><div class="imgvenue"><img src="<?php echo 'venueimg/'.$show_venue['venueimg']; ?>" /></div></center></td>

        <td ><center><div class="bine"><?php echo $show_venue['venue']; ?> - RM <?php echo $show_venue['price']; ?></div></center></br>
        <div class="dv"><p>&nbsp;<b>Address : </b><?php echo $show_venue['address']; ?></p>
        <p>&nbsp;<b>Detail : </b><?php echo $show_venue['detail']; ?></p>
        <b>&nbsp;Contact No: </b><?php echo $show_venue['contact']; ?></div>
        </td>
        <td style="width:20%;">
        <center><a href="map.php" target="_blank"><input type="button"  class="button" value="MAP" style="width:100px;"></a>
        <input type="submit" class="button" style="width:100px;" value="CHOOSE" name="choose_venue"></center>


        </td>

    </tr>
        </table></center><br>
</form>
<?php
        $_SESSION['theurl'] = $show_venue['url']; 

}   
?>

<?php 
    if(isset($_POST['choose_venue']))
{
    $getvenue = $_POST['getvenue'];
    $getvenueprice = $_POST['getvenueprice'];



    $savevenue = mysql_query("insert into selectvenue(user,title,venuename,venueprice) values('$username','$title','$getvenue','$getvenueprice')");
    if($savevenue)
        {
            echo"<center>$getvenue  save.</center>";

        }
        else
        {
            echo "Failed.";

        }
}
?>
</div>

你可以用这种方式通过锚定标记传递值。我希望这对你有所帮助

<a  href="map.php?getvenueurl=<?php echo $show_venue['url']; ?>" target="_blank"><input type="button"  class="button" value="MAP" style="width:100px;"></a>

而不是

 <a href="map.php" target="_blank"><input type="button"  class="button" value="MAP" style="width:100px;"></a>

编写此代码

<input type="button"  class="button" onclick="submit_to_map()" value="MAP" style="width:100px;">

然后将此javascript代码放在页面上

<script type="text/javascript">
function submit_to_map() {
    var form = document.getElementById("form-id");
    form.action = "map.php";
    form.submit();
}
</script>

函数submit_to_map(){
var form=document.getElementById(“表单id”);
form.action=“map.php”;
表单提交();
}

然后,您可以从map.php获取表单中包含$\u POST[]的所有元素的值。希望这将有助于您确认每页开头都有

您好,谢谢您的回复,但仍然和以前一样,您可以通过$get['getvenueurl']从url获取值,您的意思是在map.php中声明
$您的get['getvenueurl']
?哦,是的!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!只需使用这种简单的方法~谢谢,使用它,您不仅可以获取getvenueurl,还可以获取所有输入(包括隐藏)字段值。
<script type="text/javascript">
function submit_to_map() {
    var form = document.getElementById("form-id");
    form.action = "map.php";
    form.submit();
}
</script>