for awhile i've been trying to make this code work for this form's database, but it just wouldn't work properly.
this is the form input without PI_ID this is the form input with PI_ID
$content = $_POST['cr_code'] . "-" . $_POST['cr_num'] . "-" . $_POST['cr_mon'] . "-" . $_POST['cr_year'] . "-" . $_POST['cr_modul'] . "-" . $_POST['cr_phase'] . "-" . $_POST['cr_pi_id'];
this output was faulty as the output will be "CR-001-08-18- -"if i dont want to input any module or phase, because of the lines behind 18 are not supposed to be there.
basically the output is CR-001-08-18-Marketing-PH1-PI1, the Module(Marketing),Phase(PH1),and PI_ID(PI1) is optional to fill so it could either be:
- CR-001-08-18-Marketing(Module filled, Phase unfilled, PI_ID unfilled)
- CR-001-08-18-PH1(Module unfilled, Phase filled, PI_ID Unfilled)
- CR-001-08-18-PI(Module unfilled, Phase unfilled, PI_ID filled)
this was the code i tried using if else
$phase=$_GET['cr_phase'];
$modul=$_GET['cr_modul'];
$crpid=$_GET['cr_pi_id'];
if ($phase!='' && $modul='' && $crpid='')
{
$content = $_POST['cr_code'] . "-" . $_POST['cr_num'] . "-" . $_POST['cr_mon'] . "-" . $_POST['cr_year'] . "-" . $_POST['cr_phase'];
}else if($phase='' && $modul!='' && $crpid='')
{
$content = $_POST['cr_code'] . "-" . $_POST['cr_num'] . "-" . $_POST['cr_mon'] . "-" . $_POST['cr_year'] . "-" . $_POST['cr_modul'];
}else if($phase='' && $modul='' && $crpid=!'')
{
$content = $_POST['cr_code'] . "-" . $_POST['cr_num'] . "-" . $_POST['cr_mon'] . "-" . $_POST['cr_year'] . "-" . $_POST['cr_pi_id'];
}else if($phase!='' && $modul!='' && $crpid!='')
{
$content = $_POST['cr_code'] . "-" . $_POST['cr_num'] . "-" . $_POST['cr_mon'] . "-" . $_POST['cr_year'] . "-" . $_POST['cr_modul'] . "-" . $_POST['cr_phase'] . "-" . $_POST['cr_pi_id'];
}else
{
$content = $_POST['cr_code'] . "-" . $_POST['cr_num'] . "-" . $_POST['cr_mon'] . "-" . $_POST['cr_year'];
}
but it doesn't work as it just display "CR-001-08-18" without showing the phase and module, even when i inputted the phase, module, and PI_ID
anyone can help?
Aucun commentaire:
Enregistrer un commentaire