javiz Posted June 13, 2007 Report Share Posted June 13, 2007 Varbūt kādam ir zināms risinājums, kāpec nevar izmanott mainīgos $$q : rāda Undefined variable <input type=radio name=q$id value=\"$opt1\"> ... $q = $result["q"]; // dabujam nosaukumu kurs vienadas ar q$id ... if ($$q == $answer) // kā iegūt radiopogas value , ja skaits mainīgs?! Link to comment Share on other sites More sharing options...
hackerman Posted June 13, 2007 Report Share Posted June 13, 2007 Lieto search. ;) http://php.lv/f/index.php?showtopic=7238 Link to comment Share on other sites More sharing options...
javiz Posted June 13, 2007 Author Report Share Posted June 13, 2007 sak likties ka vaina kados iestadijumos vai kur citur, jo sitais <FORM METHOD=POST onclick ACTION="testing.php"> <?php $j=1; while($j<3){ echo"jaut nr $j<br>"; $i=1; while($i<4){ ?> <INPUT TYPE="radio" NAME="<?php echo"zz$j"; ?>" value="<?php echo $i; ?>"> ss <?php echo $i; ?> <?php $i++; } echo"<p>"; $j++; } ?> <INPUT TYPE="submit" value=aiziet> </form> <?php echo "<BR>vērtība1 - $zz1"; echo "<BR>vērtība2 - $zz2"; ?> comam strada a man ne! kadam ir ietekumi ko iestadijumos pamainit?! Link to comment Share on other sites More sharing options...
hackerman Posted June 13, 2007 Report Share Posted June 13, 2007 paste.php.lv :P Link to comment Share on other sites More sharing options...
Exzo Posted June 13, 2007 Report Share Posted June 13, 2007 1) kas tas tāds "METHOD=POST onclick "? 2) $zz1 un $zz2 tika nosūtītas ar POST, značit "echo '<BR>vērtība1 - '.$_POST['zz1'];" ut.t.t. Link to comment Share on other sites More sharing options...
john.brown Posted June 13, 2007 Report Share Posted June 13, 2007 Nu gan jau ka kārtējais register_globals=off. Forums par galīgu sviestu palicis - neviens neko nemeklē un nedomā, tik dodiet gatavus risinājumus. Tu, droši vien, esi jau 1002, kas uzdod šitādu jautājumu... Link to comment Share on other sites More sharing options...
Exzo Posted June 13, 2007 Report Share Posted June 13, 2007 Domāšana vispār nekas labs nav, jo bojā sejas izteiksmi :) Link to comment Share on other sites More sharing options...
Grey_Wolf Posted June 14, 2007 Report Share Posted June 14, 2007 Varbūt kādam ir zināms risinājums, kāpec nevar izmanott mainīgos $$q : rāda Undefined variablekā iegūt radiopogas value , ja skaits mainīgs?! 1. kam tev to vajag? 2. skaitam nav noziimes visu izskjir zinaashanas ;) <input type="radio" name="vards" value="1"> ..... <input type="radio" name="vards" value="n"> un savaac ar $_['vards'].... -------- respektiivi radiobutonam ir vienalga cik tev buus ierakstu vissi kam buus vienaads vaards ..... buus vienaa grupaa.... un atgriesta tiks taa vertiiba kursh buus ieklikots.... ---------------------- Link to comment Share on other sites More sharing options...
javiz Posted June 14, 2007 Author Report Share Posted June 14, 2007 nu bet ari nosaukums ir mainigs, atkarigs no db ieraksta! ar konstantu nosakumu jau viss ok! Link to comment Share on other sites More sharing options...
john.brown Posted June 14, 2007 Report Share Posted June 14, 2007 javiz, un tu gribi teikt, ka šitāds variants tev neiet? <form action="" method="POST"> <input type="radio" name="zz1" value="1"/> <input type="radio" name="zz1" value="2"/> <input type="submit" name="submit" value="Submit"/> </form> <?php if(isset($_POST['submit'])) { $name = 'zz1'; echo 'Value:'.$_POST[$name]; } ?> Link to comment Share on other sites More sharing options...
javiz Posted June 14, 2007 Author Report Share Posted June 14, 2007 nu sadi iet, bet seit jau ir konstantais nosaukums zz1, ta mana vajadziba ir dinamisko dabut! Link to comment Share on other sites More sharing options...
larvae Posted June 14, 2007 Report Share Posted June 14, 2007 Ja jau Tev vajag dinamisku, tad secinu, ka ir vairākas radiopogu grupas. Piedāvāju variantu: uztaisi, lai uzģenerētajā HTML ir pēc šāda principa: <input type="radio" name="choice[1]" value="1"/> <input type="radio" name="choice[1]" value="2"/> <input type="radio" name="choice[1]" value="3"/> <input type="radio" name="choice[2]" value="1"/> <input type="radio" name="choice[2]" value="2"/> <input type="radio" name="choice[2]" value="3"/> pie datu iehavošanas ievadam var piekļūt šādi: foreach ($_POST['choice'] as $k => $v) { echo $k."grupā iebakstīts ".$v; } Manuprāt, sanāks pārskatāmāk un nebūs jālauž acis. Link to comment Share on other sites More sharing options...
Exzo Posted June 14, 2007 Report Share Posted June 14, 2007 (edited) Tad taisi name kā masīvu: [..] NAME="zz[<?=$j;?>]" [..] Edited June 14, 2007 by Exzo Link to comment Share on other sites More sharing options...
dmitriy Posted June 14, 2007 Report Share Posted June 14, 2007 (edited) foreach ($_POST as $key => $value) { ... } ja tev bus tikai radio Edited June 14, 2007 by dmitriy Link to comment Share on other sites More sharing options...
javiz Posted June 14, 2007 Author Report Share Posted June 14, 2007 paldies, risinajumu jau atradu !:) Link to comment Share on other sites More sharing options...
Recommended Posts