Forum Moderators: coopster
<form action="get_directions.php" method="post">
<input type="text" name="listing_id" value="<?php echo $_GET['listing_id']; ?> " />
<input type="text" name="address" />
</form>
<input type="submit" value="Get Directions" name="subbut_105"> But I personally think the JS option is more elegant. Could tie the two together though: use JavaScript to hide (and disable) the submit buttons and replace them with links to call the redirect function. Then you have your functionality and a backup for non JS users.<?php
if(count($_POST)) {
$hidden = '';
foreach($_POST as $key => $value) {
if(substr($key, 0, 6) === "subbut") {
$num = end(explode("_", $key));
}
$hidden .= '<input type="hidden" name="' . $key . '" value="' . htmlentities($value, ENT_QUOTES) . '">';
}
}
?><form method="post" action="/get_directions.php?listing_id=<?php=$num ?>">
<?php=$hidden ?>
<input type="submit" value="View search results">
</form>