Click here to Skip to main content
15,901,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a form and it has two combo boxes, each boxes are containing yes,no values.

if both boxes are yes then execute stage 1 on php code
else if one box value=yes and other box value = no then execute stage 1 on php code
else if one box value=no and other box value = yes then execute stage 1 on php code
else execute stage 4 on php code

but this always execute stage 4 it is not getting the values

What I have tried:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Manage Account</title>
<link rel="stylesheet" type="text/css" href="CSS/Style SheetGeneral.css">
</head>
<body>
<br><br><br>

<table background="Images/Back Ground Images/BG1.jpg" border="2" align="center" width ="825" height="820">

<th align=center valign=center>

<form action="searchAccount.php" method="POST"/>

    <div class="textcenter1">
        <h2>Manage An Account</h2>
    </div>

<br><br>

<table border="0"; align="center" width ="655" height="550" >
<tr>
<td>
NIC Attachment :<select name="NicChk">
                <option selected="" value="">(New Document?)</option>
                <option value="yes">YES</option>
                <option value="no">NO</option>
                </select></td>
<td>
    <input type="file" name="Nic_Img" accept="image/*">
</td>
</tr>
<tr>
<td>
Registration Certificate :  <select name="RCcheck">
                            <option selected="" value="">(New Document?)</option>
                            <option value="yes">YES</option>
                            <option value="no">NO</option>
                            </select></td></td>
<td>
    <input type="file" name="Reg_Cer" accept="image/*">
</td>
</tr>
<tr>
<td></td>
<td>
    <input align="left" type="image" src="Images/Buttons/button_search.png" alt="button" name="search" value="Search" width="110" height="50"/>
 
</td>
</tr>
</table>
</form>

</th>
</table>
<br><br>

</body>
</html>



<?php
$con= mysqli_connect("localhost","root","1234","latgsjason");
if (mysqli_connect_error()){
echo"Failed to Connect";
}
if(('$_POST[NicChk]'=="yes")&&('$_POST[RCcheck]'=="yes"))
{
    echo "stange 1";
}
else if(('$_POST[F_Name]'=="yes")&&('$_POST[Address]'=="no"))
{
    echo "stange 2";
}
else if(('$_POST[NicChk]'=="no")&&('$_POST[RCcheck]'=="yes"))
{
    echo "stange 3";
}
 else if(('$_POST[NicChk]'=="no")&&('$_POST[RCcheck]'=="no"))
{
     echo "stange 4";
}
else
{
    echo "stange 4";
}
Posted
Updated 15-Jul-17 22:47pm

Why the quotations? instead of
'$_POST[NicChk]'
, just
$_POST[NicChk]
, and this appears to be redundant,
 else if(('$_POST[NicChk]'=="no")&&('$_POST[RCcheck]'=="no"))
{
     echo "stange 4";
}
 
Share this answer
 
i have found my mistake

instead of using
if(('$_POST[NicChk]'=="yes")&&('$_POST[RCcheck]'=="yes"))


i have to change it as
if(($_POST['NicChk']=="yes")&&($_POST['RCcheck']=="yes"))



Thanks for help guys!
 
Share this answer
 
Comments
Kornfeld Eliyahu Peter 16-Jul-17 5:11am    
Nice... So you are saying you would not able to read the other solution in the past 4 days?
Member 13049972 24-Jul-17 4:59am    
well im sorry, im still new to the site. i found the mistake and posted it after, but it took me few days to submit it as an answer :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900