I have a form that will be used for different action(inserting and updating). I use isset function for updating purpose. This is the complete code :
<div id="form_daftar">
<?php echo form_open($action) ?>
<?php
if($action === 'backend/pengurus/add')
$pengurus['email'] = '';
?>
<p id="input_nama">
Nama : <?php echo form_input('txt_nama', isset($pengurus['nama'])?$pengurus['nama']:"");?>
</p>
<p id="input_email">
Email : <?php echo form_input('txt_email',
isset($pengurus['email'])?$pengurus['email']:"");?>
</p>
<p id="input_password">
Password : <?php echo form_password('txt_pengurus');?>
</p>
<p id="input_alamat">
Alamat : <?php echo form_input('txt_alamat', isset($pengurus['alamat'])?$pengurus['alamat']:"");?>
</p>
<p id="input_tanggal_lahir">
Tanggal Lahir : <input type="text" id="datepicker" name="datepicker"
value="<?php echo isset($pengurus['tanggal_lahir'])?$pengurus['tanggal_lahir']:""?>"/>
</p>
<?php
$action === 'backend/pengurus/add' ? $label = "Daftarkan Pengurus" : $label = "Update Data Pengurus";
echo form_submit('btn_insert', $label);
?>
<?php echo form_close(); ?>
</div>
However, i got a weird bug so the isset is not working correctly. So, i tried to add this piece of code (snippet from above) :
<?php
if($action === 'backend/pengurus/add')
$pengurus['email'] = '';
?>
However, the $pengurus['email'] is not recognized, although its recognized in the form below this code (look the complete code).
What should i do?
Any help is appreciated, please just ask me if you dont understand my question (English is not my native languange). Thanks:D