HELP CHRONOFORM !

tonythuan 15 Apr, 2009
Hi, Greyhead !
i have a table following . i created a form with chronoform to insert values to the table.
i have code following. But it don't work . Please help me !
TABLE : dl_thongsotram
Field Type Null
matram : varchar(50) No
tentram : varchar(50) No
machinhanh : varchar(50) No
masohuu : varchar(50) No
sopha : float No
congsuat : float No
dungluong : float No
idm : float No
ian : float No
ibn : float No
icn : float No
ion : float No
ufn : float No
udn : float No
iad : float No
ibd : float No
icd : float No
iod : float No
ufd : float No
udd : float No
hesotai : float No
hesolechpha : float No
tinhtrangtai : varchar(50) No
tinhtranglechpha : varchar(50) No
ngaydo : varchar(50) No
nguoido : varchar(50) No
maqui : varchar(50) No



CODE :
<?php
$matram = JRequest::getString('matram', '', 'post');
$tentram = JRequest::getString('tentram', '', 'post');
$machinhanh = JRequest::getString('machinhanh', '', 'post');
$masohuu = JRequest::getString('masohuu', '', 'post');
$sopha = JRequest::getFloat('sopha', '', 'post');
$congsuat = JRequest::getFloat('congsuat', '', 'post');
$dungluong = JRequest::getFloat('dungluong', '', 'post');
$idm = JRequest::getFloat('idm', '', 'post');
$ian = JRequest::getFloat('ian', '', 'post');
$ibn = JRequest::getFloat('ibn', '', 'post');
$icn = JRequest::getFloat('icn', '', 'post');
$ion = JRequest::getFloat('ion', '', 'post');
$ufn = JRequest::getFloat('ufn', '', 'post');
$udn = JRequest::getFloat('udn', '', 'post');
$iad = JRequest::getFloat('iad', '', 'post');
$ibd = JRequest::getFloat('ibd', '', 'post');
$icd = JRequest::getFloat('icd', '', 'post');
$iod = JRequest::getFloat('iod', '', 'post');
$ufd = JRequest::getFloat('ufd', '', 'post');
$udd= JRequest::getFloat('udd', '', 'post');
$imax = max($ian,$ibn,$icn,$iad,$ibd,$icd);
$iomax = max($ion,$iod);
$hesotai = $imax/$idm;
JRequest::setVar('hesotai', $hesotai);
if ( $hesotai < 0.3 ) {
$tinhtrangtai = "Non T?i";
} else{
if ( $hesotai < 0.8 ) { $tinhtrangtai = "Bình Thuong";}
else {
if( $hesotai < 1) { $tinhtrangtai = " Ðay Tai"; }
else { $tinhtrangtai = " Quá Tai " ; }
}
}

JRequest::setVar('tinhtrangtai', $tinhtrangtai);
$hesolechpha = $iomax/$imax;
JRequest::setVar('hesolechpha', $hesolechpha);
if ( $hesolechpha < 0.25 ) { $tinhtranglechpha = " Bình Thuong " ;}
else { $tinhtranglechpha = " Lech Pha ";}
JRequest::setVar('tinhtranglechpha', $tinhtranglechpha);
$ngaydo = JRequest::getString('ngaydo', '', 'post');
$nguoido = JRequest::getString('nguoido', '', 'post');
$maqui = JRequest::getString('maqui', '', 'post');
?>
GreyHead 15 Apr, 2009
Hi tonythuan,

I have no idea what most of this code is supposed to be doing. [sendfb][/sendfb]
Bob
tonythuan 15 Apr, 2009
This is backup form .
Please help me Greyhead !
GreyHead 16 Apr, 2009
Hi tonythuan,

I removed a few unnecessary lines from your code but as far as I can see it works OK. What exactly is the problem?

Bob
<?php
$ian = JRequest::getFloat('ian', '', 'post');
$ibn = JRequest::getFloat('ibn', '', 'post');
$icn = JRequest::getFloat('icn', '', 'post');
$iad = JRequest::getFloat('iad', '', 'post');
$ibd = JRequest::getFloat('ibd', '', 'post');
$icd = JRequest::getFloat('icd', '', 'post');
$imax = max($ian, $ibn, $icn, $iad, $ibd, $icd);

$ion = JRequest::getFloat('ion', '', 'post');
$iod = JRequest::getFloat('iod', '', 'post');
$iomax = max($ion, $iod);

$idm = JRequest::getFloat('idm', '', 'post');
$hesotai = $imax/$idm;
JRequest::setVar('hesotai', $hesotai);

if ( $hesotai < 0.3 ) {
    $tinhtrangtai = "Non Tai";
} elseif ( $hesotai < 0.8 ) { 
    $tinhtrangtai = "Bình Thuong";
} elseif( $hesotai < 1 ) {
    $tinhtrangtai = " Ðay Tai";
} else { 
    $tinhtrangtai = " Quá Tai " ; 
}
JRequest::setVar('tinhtrangtai', $tinhtrangtai);

$hesolechpha = $iomax/$imax;
JRequest::setVar('hesolechpha', $hesolechpha);

if ( $hesolechpha < 0.25 ) { 
    $tinhtranglechpha = " Bình Thuong " ;
} else { 
    $tinhtranglechpha = " L?ch Pha ";
}
JRequest::setVar('tinhtranglechpha', $tinhtranglechpha);
?>
tonythuan 16 Apr, 2009
thank you to your quick respon !
i have used this code . but when i run it, the values were not inserted to my table(dl_thongsotram) on my DB.
what is the error !
tonythuan 16 Apr, 2009
:P 😛 😛 😛

it's great , GreyHead !
I do it successfully .
thank you very very very much !
😛
This topic is locked and no more replies can be posted.