lundi 14 octobre 2019

Php if else yes/no

am trying to add a function to a script where a user is ask for code, which i have added. but having one issue of i want to unable when to ask the user code and when to to ask . so i need a php if else and it sql so when i unable to ask code for a user it will ask code and when i disable it wont ask code below is the one i have tried

if ((['yes'])) {
  // Yes

<div id="cot_div" align="center">
    <p>Please enter your <strong id="code_up">COT</strong> code to continue</p>



    <form id="form3" name="form3" method="POST" action="inter_suc.php">  
   <table border="0" id="trans" align="center" >
  <tr>
    <td align="center" style="padding:0px"><span id="sprytextfield1">
      <input name="cot" type="text" id="cot" size="10" />
      <span class="textfieldRequiredMsg"></span></span>

      <span id="sprytextfield2">
      <input name="tax" type="text" id="tax" size="10" />
      <span class="textfieldRequiredMsg"></span></span>
      <span id="sprytextfield3">
      <input name="imf" type="text" id="imf" size="10"  />
      <span class="textfieldRequiredMsg"></span></span><br />  <span id="error">
      wrong COT Code</span>
      </td>
    </tr>
  <tr>
    <td align="center" style="padding:0px"><input type="button" name="go" id="go" value="Go" />
      <input type="button" name="go2" id="go2" value="GO" />
      <input type="button" name="go3" id="go3" value="GO" />

    </td>
  </tr>

} else {
  // No

<div id="cot_div" align="center">
    <p>Please enter your <strong id="code_up">COT</strong> code to continue</p>



    <form id="form3" name="form3" method="POST" action="inter_suc.php">  
   <table border="0" id="trans" align="center" >
  <tr>
    <td align="center" style="padding:0px"><span id="sprytextfield1">
        <input name="cot" type="hidden" id="cot" value="<?php echo $_POST['cot'];?>" />
      <span class="textfieldRequiredMsg"></span></span>

      <span id="sprytextfield2">
      <input name="tax" type="hidden" id="tax" value="<?php echo $_POST['tax'];?>" />
      <span class="textfieldRequiredMsg"></span></span>
      <span id="sprytextfield3">
       <input name="imf" type="hidden" id="imf" value="<?php echo $_POST['imf'];?>" />
      <span class="textfieldRequiredMsg"></span></span><br />  <span id="error">
      wrong COT Code</span>
      </td>
    </tr>
  <tr>
    <td align="center" style="padding:0px"><input type="button" name="go" id="go" value="Go" />
      <input type="button" name="go2" id="go2" value="GO" />
      <input type="button" name="go3" id="go3" value="GO" />

    </td>
  </tr>

}

Aucun commentaire:

Enregistrer un commentaire