I post a hidden field with every submit button using GET method.
<?php
if(isset($_GET["topic"]))
{
$topic=$_GET["topic"];
?>
<input type="hidden" name="topic" value=<?php echo $topic; ?>/>
<?php
}
?>
The problem is when I click the submit button and I get this / ‘slash’ in my url.
got topic cars/
(when printed with echo on the screen)
With every button press I get another slash..and my url comes to look like this..
http://localhost/IHow/home.php?searchEngine=&topic=cars%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F&page=0
How to prevent this from happening, cause I need the topic url variable for my mysql query..
You don’t have quotes around the
valueattribute, and you also don’t have a space between the attribute and the trailing slash. The slash is considered to be a part of thevalueattribute, so it gets sent. Add quotes, add a space, or do both.As TheifMaster says, you should also use
htmlspecialchars()ontopic