Forums

How to compare between input value and field value before saving

ckpk1980 03 Nov, 2016
Good day,

Can anyone show me how to compare input value (textbox) and table value in chronoconnectivity. I want to make sure user key in the exact same data (for authentication purpose) before submitting to database.

i put some codes inside chronoconnectivity > Front list > Action > Edit > code ..
Name: <input type="text" name="baca[nama_penuh]" disabled /><br>
Title: <input type="text" name="baca[tajuk_surat]" disabled /><br>
Reference No: <input type="text" name="baca[no_rujukan]" disabled /><br> 
Date: <input type="text" name="baca[created]" disabled /><br>
Status: <input type="text" name="baca[hantar]" disabled /><br><br>

<?php
$uniq = $row['baca']['uniq_id'];
$code= $row['baca']['vcode'];
$isvstatus = $row['baca']['vstatus'];
if (($isvstatus == "1") && ($uniq === $code)) {
echo'<font color="red">Already Signed</font>';
echo "<br>";
echo "Kod Digital:";
echo '<input type="text" name="baca[vcode]"  disabled/>';
echo '<input type="hidden" name="baca[id]" />';
echo "<br>";
echo '<input type="hidden" name="baca[vstatus]" />';
echo "<br>";
echo "<br>";
}else{
echo "Sign Here:";
echo '<input type="textbox" name="baca[vstatus]" value="1" readonly />';
echo "<br>";
echo "Kod Digital:";
echo '<input type="text" name="baca[vcode]" />';
echo '<input type="hidden" name="baca[id]" />';
echo "<br>";
echo '<input type="submit" value="Save" />';
echo "<br>";
echo "<br>";
}
?>

so far, the coding is working.. but it didn't do the comparing value before user click the submit button.

Anyone has any ideas so that i can settle my problem??

Tqvm..
GreyHead 03 Nov, 2016
Hi Tqvm,

I suggest that you add some debugger code to echo out the values and see exactly what is there and why the check is failing. You might also replace the === with == - that can make a difference.

Bob
This topic is locked and no more replies can be posted.