[英]Need help to use the following line of code to do a post method in html
我的值如下,我需要值来做post方法。 我尝试了以下方法,但 post 方法不起作用。
<input type="hidden" name="return_url" value="<?php echo URLROOT; ?>/shop/payment" >
echo '<form method="post" name="myform" action="script to check and manipulate your posts">
<input type="hidden" name="return_url" value="'.URLROOT.'/shop/payment" >
</form>';
如果您提交此表单,您将在 POST 中获得 return_url,但您需要编写一个脚本来重定向到 return_url 中给出的 url
假设您有 2 个文件:
---------- form_file.php
<!DOCTYPE html>
<html>
<body>
<form method='post' name='myform' action='post_read.php'>
<input type='text' name='return_url' value='blablabla.php'>
<input type='submit' name='submit_btn' value='SUBMIT THIS FORM'>
</form>
</body>
</html>
---------- post_read.php
<?php
echo "POST VARIABLE: ".$_POST['return_url'];
?>
因此 form_file.php 会将 POST 变量发送到 post_read.php 文件。 当然如果两个文件在同一个目录下,否则在form_file.php中form标签的“action”属性中给form_read.php正确的地址
在我的示例中,return_url 输入字段为 TEXT 类型,以显示发送到 post_read.php 文件的值,但您可以在 post_read.php 中使用相同的结果将类型更改为隐藏
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.