The next question is how to send a request get for example localhost? Name = yes, select the desired radio button in the form? If you cannot do this with radio, can it be done with selectom or, with chekbox?
- Again, nothing can be done without libraries. Radio buttons, like select, upon arrival at the server have the property Name = Value. The name is the name of the element that you write. The value is a variant from the options offered by you (the developer) for this group of radio buttons or the value value of the option tag included in the select tag. - istem
- When forming a group (radio or select), you compare the incoming value related to the name of the variable of interest with the generated values for the radio buttons or the option of the select tag. In the case of a match, set the attribute for radio - checked = "checked" for option - selected = "selected". - istem
|
2 answers
In general, I can tell you how to do this on jQuery :
$(document).ready(function(){ var radio = $('#myRadio').prop('checked'); //Отбираем radio с ID myRadio if(radio == true){ alert('Вы кликнули по Радио'); } });
|
<input type="radio" value="someValue" <? if ($_GET['name'] == 'yes') echo 'checked' ?> />
Something like this, no?
- does not work, because <input type = "radio"> are displayed foreach, is it possible to catch the necessary input by id? preferably on javascript - ochumelec
- @ochumelec, let's not read the tea leaves, and you will finish the question with at least some code! - Palmervan
- oneok, opencart engine, product.tpl <? php if ($ option ['type'] == 'image') {?> <? php foreach ($ option [option_value '] as $ option_value) {?> < input type = "radio" name = "option [<? php echo $ option ['product_option_id'];?>]" value = "<? php echo $ option_value ['product_option_value_id'];?>" id = "option- value - <? php echo $ option_value ['product_option_value_id'];?> "/> <? php}?> <br /> <? php}?> - ochumelec
- one@gooda, go here to you govnokod.ru - k0mar
|