Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Problem z parametrem checked w input
Astan
post 29.05.2015, 17:31:21
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
Turson
post 29.05.2015, 19:42:20
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 29.05.2015, 19:46:20
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 29.05.2015, 19:55:49
Post #4





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

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


Dziękuje za pomoc smile.gif
Go to the top of the page
+Quote Post
Pyton_000
post 30.05.2015, 09:34:37
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
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 9.06.2024 - 08:13