[英]Passing a php variable from a form input into a href link that is part of an echo
The input..输入..
<input class="myButton" style="width: 60px" type="number" min="1" max="200" step="1" name='pages' value='<?php echo "$pages";?>'/>
My attempt to pass the variable $pages我尝试传递变量 $pages
if(count($uploadedFiles)>0){
echo "<b>Uploaded:</b>";
echo "=";
foreach($uploadedFiles as $fileName)
{
echo " ".$fileName.",";
}
$var=$_POST['pages'];
echo '<br><a href="http://www.myurl.com/index.php?pages=';$_GET["var"];" target="_blank">View Pages</span></a>';
}
}
else{
echo "ERROR: Please press the browse button and select a CSV file to upload.";
}
This does not add the desired number so the clicked URL becomes.. http://www.myurl.com/index.php?pages=x
(where x is the number entered in the form)这不会添加所需的数字,因此单击的 URL 变为.. http://www.myurl.com/index.php?pages=x
(其中 x 是在表单中输入的数字)
I've taken a completely different approach to this now and got it functioning as I'd like.我现在对此采取了完全不同的方法,并按照我的意愿运行。
Many thanks for your help and pointers.非常感谢您的帮助和指点。
<form action="myurl.com/index.php?pages=$pages" method="get" target="_blank">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.