Insert an "IF" with "DO" to validate _POST field

Asked

Viewed 44 times

0

Gentlemen, can someone help me with the code below? I need to put an IF before the DO. I need to validate a _POST variable [so_server}. If it is Linux after DO would put a form structure, ELSE put another form structure.

Can help?

<?php
            do {  
            ?>
    <div id="tabs-<?php echo $row_menu_servidor['host_servidor']?>">
        <div id="id_solic"><div style="position: absolute; margin-left:10px; margin-top:-10px; width:100px; height: 10;"><br/>
            <h4>ID Solicitação<br>
            <form name="form-<?php echo $row_menu_servidor['host_servidor']?>" method="post" action="">
                <input name="id_solic" id="id_solic" type="text" value="<?php echo $_POST['id_solic'];?>" size="5" readonly="readonly">
                <input name="infra_basica" id="infra_basica" type="text" value="<?php echo $row_menu_servidor['host_servidor']; ?>" size="5" readonly="readonly">
              <input name="so_servidor" id="so_servidor" type="text" value="<?php echo $row_menu_servidor['so_servidor']; ?>" size="5" readonly="readonly">
                <br><br>
            </form>
        </div>
        </div>
    </div>  
            <?php
                } while ($row_menu_servidor = mysql_fetch_assoc($menu_servidor));
                    $rows = mysql_num_rows($menu_servidor);
                        if($rows > 0) {
                            mysql_data_seek($menu_servidor, 0);
                            $row_menu_servidor = mysql_fetch_assoc($menu_servidor);
                            }               
            ?>
  • 1

    What’s the problem? DO NOT use DO-WHILE to iterate database records your variable will only have value at the end of the iteration. DO NOT use functions removed from PHP.

1 answer

-1


if(...){
    do{
        ...
    }while(...){}
}else{
    ...
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.