pm4698 Posted August 20, 2014 Share Posted August 20, 2014 Hello there, I have 2 questions: 1) Look here: http://www.hellastransfers.com/booking/taxi.php I have a form and i want to pass values from URL to fields. So, for example to pass a value to Prefered driver ID field you write this: http://www.hellastransfers.com/booking/taxi.php?drivercode-123 and the value 123 is passed to that field. I did this with this code: <?php $sDriverCode = $_REQUEST['drivercode']; ?> <input style="width:100px;" name="drivercode" id="drivercode" value="<?=$sDriverCode?>" data-mini="true" /> At the same form i have some radio-type fields. Its the one you see at Type of Vehicle (Standard, Premium etc). When i try to do the same, i cannot get this to work. What i am trying to do is this: <?php $sCar = $_REQUEST['vehicle_choice']; ?> <input type="radio" name="vehicle_choice" id="vehicle_standard" value="standard" <?= ($sCar == 'standard' ? 'checked' : '') ?> /> <label for="vehicle_standard" class="myButton">Standard</label> <input type="radio" name="vehicle_choice" id="vehicle_business" value="business" <?= ($sCar == 'business' ? 'checked' : '') ?> /> <label for="vehicle_business" class="myButton">Premium</label> and if write at URL this: http://www.hellastransfers.com/booking/taxi.php?vehicle_choice=business, then i cannot see the Premium radio box as checked. I tested and i confirmed that $sCar gets the value from URL, but somehow it seems that its not controlling the check property of input box. I also tried this: <input type="radio" name="vehicle_choice" id="vehicle_business" value="business" checked="<?= ($sCar == 'business' ? 'checked' : '') ?>" /> this: <input type="radio" name="vehicle_choice" id="vehicle_business" value="business" <? if ($sCar == 'business') { ?> checked <? } ?>" /> and this: <input type="radio" name="vehicle_choice" id="vehicle_business" value="business" <? if ($sCar == 'business') { ?> checked="checked" <? }?> /> with no results. I also tried to avoid short tags (<?= ) and use this <?php echo but still the same. Any ideas? 2) At this link: https://hellastransfers.com/online-booking.html you see the form from this link: http://www.hellastransfers.com/booking/taxi.php If i try to pass values to first link through ULR (https://hellastransfers.com/online-booking.html), values are not passed. What should i do, in order the coding i did at first question to be in valid at this ULR: https://hellastransfers.com/online-booking.html? Thank you in advance Quote Link to comment Share on other sites More sharing options...
BuildMyWeb Posted August 20, 2014 Share Posted August 20, 2014 in your conditional for the radio button, try checked="checked" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.