我已在主页上设置了一个搜索框,该搜索框应通过传递网址链接到Opencart搜索。
我遇到的问题是生成的网址始终是未编码的:
<?php
$url1 = json_decode(file_get_contents('http://www.movie.com:/retrieveMovies'));
$counter = count($url1);
for ($i = 0; $i < $counter; $i++){
$movieID = $url1[$i]->movieId ;
$url2 = json_decode(file_get_contents(' http://movie.com/movieOne?seatNum=' . $movieID),TRUE);
foreach ($url2 as $obj){
$testingResult = $obj['avail'];
echo "<button onclick = testBTN('".$testingResult."')>Seat ID</button>";
}
}
?>
<script>
function testBTN(x) {
if (x == "OK"){
alert("Seat booked" );
}
else
{
alert("Error in booking seats" );
}
}
</script>
我的目标是
store/index.php?route%3Dproduct%2Fsearch%26filter_name=test
我目前的代码是:
store/index.php?route=product/search&filter_name=test
我尝试过编码,解码,html_entity_decode,urldecode,rawurldecode ...
我已尝试将表单方法设为<?php
$storesearch = $_REQUEST['store-search'] ;
$filter = 'route=product/search&filter_name';
$filtered = html_entity_decode($filter);
?>
<form id="store" method="GET" action="http://localhost/vinmobile/store/index.php?<?php echo $storesearch; ?>">
<input type="text" id="store-search" name="<?php echo $filtered; ?>" value="Store Search" onclick="this.value = '';">
<input type="submit" name="" value="Search">
</form>
<?php echo $filtered; ?> // Just to show it onscreen to make sure it's written correctly
我已将变量声明尝试为GET, POST
每次,我仍然会看到这样的网址:
$_REQUEST, $_GET, $_POST
我确信这件事情我已经错过了,但我认为&#39;我已经尝试了一切,如果有人能指出我正确的方向,我将非常感激。
干杯
webecho
答案 0 :(得分:0)
使用Javascript结束,它完美运行:
{{1}}
感谢你的建议