Form Data Karyawan

 Posted admin
Form Data Karyawan Rating: 4,4/5 1418 reviews

I Hope my question is not wrong(not easy for you). to the point..
I have form with validation (check to database MySQL). like this
controller

this code is work with appear messages 'ERROR : No KTP sudah ada di data karyawan.!!!' but the form input will be reset. so I must input this form again.
Question
How to still appear the messages but the field not reset ?

Download SPSS for Windows now from Softonic: 100% safe and virus free. More than 28335 downloads this month. Download SPSS latest version 2018. Spss 11.5 free download. No, the software is not available for Android operating system. I have checked both Google Play Store and IBM website, but there was nothing released for.

thanks before for your time

Adi.zapAdi.zap

3 Answers

This happens because of the redirect. Basically, it reloads the page. What you can do, is after the form is validated, place the inputed values in session variables. If the form is validated correctly and no errors appear, then unset the session variables, else, redirect and on the view page, by default, in each input, place what you have in the session var. kind of like this:

echo '<input type='text' name='some_name' value='.(isset($_SESSION['some_name']) ? $_SESSION['some_name'] : ').' />

Hope it helps!
Keep on coding
Ares.

Ares DragunaAres Draguna
Prashant TapasePrashant Tapase

Surah yasin rumi pdf download. Maybe the best solution is load the view which contains the form and passing all the post array to reload inputs.

And then, again in the form view, load inputs calling:

Hope this helps. My story mod apk.

EDIT 1: My fail naming $form_contents in view and controller. Previously was wrong, now is ok.

Jv NihilistikJv Nihilistik

Not the answer you're looking for? Browse other questions tagged phpformscodeigniter or ask your own question.