[英]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.