私はcodeigniterでテストプロジェクトを作成しています。ラジオボタンとオプションでは苦労しています。 たとえば、6つの異なるラジオボタンで名前、姓などのラベルを選択して入力すると、事前質問フォームを作成したいと思います。Codeigniterのラジオボタンが機能しません[PHP、HTML]
私は必要なフィールドを入力してテストラジオボタンを適切な値に設定し、ボタンを送信するだけで何も起こりません。私は問題の原因を見つけることができません。
私はここで私は、set_radioなどあなたがここに
以下の私の例がありますform_radioを使用しようとした
(ドキュメントがset_radioを使用することを言います)フォームヘルパーを使用していますが私の見解である(私はしませんでしたその部分が動作しているので、ここで
<div class="row">
<?php
$attributes = array(
"name" => "registrationform",
"id" => "msform"
);
echo form_open("yourself/register", $attributes);
?>
<!-- progressbar -->
<ul id="progressbar">
<li class="active"><span class="circle">1</span> APPLY</li>
<li class="active"><span class="circle">2</span> FORM</li>
<li><span class="circle">3</span> CHECK</li>
</ul>
<!-- FORM Yourself -->
<fieldset>
<div class="input-box">
<h2 class="title">What licence would you like?</h2>
<input type="radio" name="what_licence" value="1" <?php echo set_radio('what_licence', '1', TRUE); ?> /> Black and white?</label>
<input type="radio" name="what_licence" value="2" <?php echo set_radio('what_licence', '2'); ?> /> Colour?</label>
</div>
<div class="form-group">
<button name="submit" type="submit" class="btn btn-default">Signup</button>
<button name="cancel" type="reset" class="btn btn-default">Cancel</button>
</div>
</fieldset>
<!-- FORM Yourself -->
</form>
<?php echo form_close(); ?>
<?php echo $this->session->flashdata('msg'); ?>
</div>
<!-- row -->
は私のコントローラである)テキスト入力を貼り付ける
$this->form_validation->set_rules('what_licence', 'What licence', 'required');
$this->form_validation->set_rules('initials', 'Initials', 'trim|required|alpha');
$this->form_validation->set_rules('lastname', 'Last Name', 'trim|required|alpha|min_length[3]|max_length[30]');
$this->form_validation->set_rules('email', 'Email ID', 'trim|required|valid_email|is_unique[yourself.email]');
$this->form_validation->set_rules('tel_number', 'Phone Number', 'required|numeric|min_length[9]|callback_uk_phone_check');
$this->form_validation->set_rules('address', 'Address', 'trim|required|alpha_numeric_spaces');
$this->form_validation->set_rules('post-code', 'Post Code', 'trim|required|alpha_numeric_spaces');
$data = array(
'what_licence' => $this->input->post('what_licence'),
'initials' => $this->input->post('initials'),
'lastname' => $this->input->post('lastname'),
'email' => $this->input->post('email'),
'tel_number' => $this->input->post('tel_number'),
'address' => $this->input->post('address'),
'post-code' => $this->input->post('post-code'),
);
'what_licence'は動作しないラジオボタン用です 私にアドバイスできれば素晴らしいかもしれません。私はうまくいきません。 ありがとうございます。
:-)答えてくれてありがとうしかし、私は、if(の$ this - > form_validation->実行()== FALSE)を持っています { //エラー $ this-> load-> view( 'yourself_registration_view'); } –
私はコードを更新します(エラーを表示します)。だから問題はどこにあるの? –
それはどこに問題があるのか分からないという問題です。私はウェブサイトの上に私をスクロールするだけで送信ボタンを押すと、それはすべてが良いようだが、まだあります。表示されているラジオの入力フィールドが正しく書かれていると思いますか(set_radio)? Pozdrawiam :-) –