如何在表单输入提交时将单词插入 URL
How to insert a word into a URL on form input submit
我想在表单中输入一个文本,供用户输入一个随机词,并将其附加到这个 URL 的末尾,其中词 "man" 是什么?然后,用户将单击按钮转到完整的 URL... 有什么想法吗? php 会很好。
https://ssl.gstatic.com/dictionary/static/sounds/de/0/man.mp3
我认为重定向可能是解决方案之一。我假设您可以使用 php.
首先,通过 POST 将您的输入传递给您页面的 URL。
其次,在您页面的 header 中,检查 POST 数据并重定向到您的目标 URL。
<?php if($_POST) {
$word=$_POST['word'];
echo "<meta http-equiv='refresh'
content='0; url=https://ssl.gstatic.com/dictionary/static/sounds/de/0/$word.mp3' />";
?>
我想在表单中输入一个文本,供用户输入一个随机词,并将其附加到这个 URL 的末尾,其中词 "man" 是什么?然后,用户将单击按钮转到完整的 URL... 有什么想法吗? php 会很好。
https://ssl.gstatic.com/dictionary/static/sounds/de/0/man.mp3
我认为重定向可能是解决方案之一。我假设您可以使用 php.
首先,通过 POST 将您的输入传递给您页面的 URL。
其次,在您页面的 header 中,检查 POST 数据并重定向到您的目标 URL。
<?php if($_POST) {
$word=$_POST['word'];
echo "<meta http-equiv='refresh'
content='0; url=https://ssl.gstatic.com/dictionary/static/sounds/de/0/$word.mp3' />";
?>