Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem z parametrem checked w input
Astan
post
Post #1





Grupa: Zarejestrowani
Postów: 28
Pomógł: 0
Dołączył: 16.01.2015

Ostrzeżenie: (0%)
-----


Witam,

w znaczniakch php dane są porównywane z danymi, które są pobierane z bazy. Po wysłaniu formualrza pole typu radio nie zostaje oznaczone. Gdzie zrobiłem błąd ?

  1. <form id="switchform" method="post">
  2. <input type="radio" name="choice" value="styl1" <?php ($user['User']['style'] == 'styl1') ? "checked" : ""; ?> onClick="chooseStyle(this.value, 60)"><?php echo $this->Html->image('czarny.png', array('width' => '150px', 'height' => '100px')); ?>
  3. <input type="radio" name="choice" value="styl2" <?php ($user['User']['style'] == 'styl2') ? "checked" : ""; ?> onClick="chooseStyle(this.value, 60)"><?php echo $this->Html->image('brazowy.png', array('width' => '150px', 'height' => '100px')); ?>
  4. <input type="radio" name="choice" value="styl3" <?php ($user['User']['style'] == 'styl3') ? "checked" : ""; ?> onClick="chooseStyle(this.value, 60)"><?php echo $this->Html->image('niebieski.png', array('width' => '150px', 'height' => '100px')); ?><br /><br />
  5. <input type="radio" name="choice" value="styl4" <?php ($user['User']['style'] == 'styl4') ? "checked" : ""; ?> onClick="chooseStyle(this.value, 60)"><?php echo $this->Html->image('pomaranczowy.png', array('width' => '150px', 'height' => '100px')); ?>
  6. <input type="radio" name="choice" value="styl5" <?php ($user['User']['style'] == 'styl5') ? "checked" : ""; ?> onClick="chooseStyle(this.value, 60)"><?php echo $this->Html->image('rozowy.png', array('width' => '150px', 'height' => '100px')); ?>
  7. <input type="radio" name="choice" value="styl6" <?php ($user['User']['style'] == 'styl6') ? "checked" : ""; ?> onClick="chooseStyle(this.value, 60)"><?php echo $this->Html->image('zielony.png', array('width' => '150px', 'height' => '100px')); ?>
  8. <br /><br /><input type="submit" value="Zapisz"/>
  9. </form>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
Turson
post
Post #2





Grupa: Zarejestrowani
Postów: 4 291
Pomógł: 829
Dołączył: 14.02.2009
Skąd: łódź

Ostrzeżenie: (0%)
-----


  1. var_dump($user['User']['style'])
daje....?

Ten post edytował Turson 29.05.2015, 19:42:37
Go to the top of the page
+Quote Post
johny_s
post
Post #3





Grupa: Zarejestrowani
Postów: 594
Pomógł: 122
Dołączył: 17.07.2005
Skąd: P-na

Ostrzeżenie: (0%)
-----


brakuje echo przy tych warunkach
Go to the top of the page
+Quote Post
Astan
post
Post #4





Grupa: Zarejestrowani
Postów: 28
Pomógł: 0
Dołączył: 16.01.2015

Ostrzeżenie: (0%)
-----


Dziękuje za pomoc (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
Pyton_000
post
Post #5





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

Ostrzeżenie: (0%)
-----


Albo zamień <?php na <?=
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.12.2025 - 21:13