php - Pass value from <form> to button? with {if $' }
one text
Solution:
Bascially wrap it in PHP's opening and closing tag, but you said you want to use index.php?currency=2
, which is a GET
request. So I believe the only way to get that is by using $_GET['currency']
unless you know where you're getting that $smarty.post
from
<form action="" method="post">
<label for="currency_sel">Currency:</label>
<select name="currency" id="currency_sel" class="form-control" onchange="submit();">
<option value="1"<?php if ($smarty.post.currency == 1) echo 'selected';?>>saudi</option>
<option value="2"<?php if ($smarty.post.currency == 2) echo 'selected';?>>dollar</option>
</select>
Source