Jump to content

disable a 'div' area with php


pouncer

Recommended Posts

[code=php:0]
                   <div align="left">
                     <p align="center"><span class="style45"><br>
                       <span class="style46">Username:<br>
                           </span></span>
                       <input name="txt_Username" type="text" class="style15" id="txt_Username">
                       <br>
                       <span class="style47">Password:</span><br>
                       <input name="txt_Password" type="password" class="style15" id="txt_Password">
                       <br>
                       <br>
                       <input name="frmLogin_Submit" type="submit" class="style11" id="frmLogin_Submit" value="Login">
                       <br>
                       <span class="style47"><a href="forgot_password.php" style="color:#ffffff">Forgot your password? </a></span></p>
                     </div>
[/code]

basically i want to disable all of that div section, but unsure how?

if ($log->IsLoggedIn() == true) {
//disable that div section
}
else {
//whatever..
}

anyway got any ideas?
Link to comment
https://forums.phpfreaks.com/topic/26624-disable-a-div-area-with-php/
Share on other sites

Could you not just put the div code into the If statement something like:

[code=php:0]if ($log->IsLoggedIn() == true) {

}
else {
                    <div align="left">
                      <p align="center"><span class="style45"><br>
                        <span class="style46">Username:<br>
                            </span></span>
                        <input name="txt_Username" type="text" class="style15" id="txt_Username">
                        <br>
                        <span class="style47">Password:</span><br>
                        <input name="txt_Password" type="password" class="style15" id="txt_Password">
                        <br>
                        <br>
                        <input name="frmLogin_Submit" type="submit" class="style11" id="frmLogin_Submit" value="Login">
                        <br>
                        <span class="style47"><a href="forgot_password.php" style="color:#ffffff">Forgot your password? </a></span></p>
                      </div>
}
[/code]
[code]<?php

if ($log->IsLoggedIn() == true) {

}
else {
  ?>
                    <div align="left">
                      <p align="center"><span class="style45"><br>
                        <span class="style46">Username:<br>
                            </span></span>
                        <input name="txt_Username" type="text" class="style15" id="txt_Username">
                        <br>
                        <span class="style47">Password:</span><br>
                        <input name="txt_Password" type="password" class="style15" id="txt_Password">
                        <br>
                        <br>
                        <input name="frmLogin_Submit" type="submit" class="style11" id="frmLogin_Submit" value="Login">
                        <br>
                        <span class="style47"><a href="forgot_password.php" style="color:#ffffff">Forgot your password? </a></span></p>
                      </div>
  <?
}


?>[/code]

You can jump in and out of PHP mode.  For the record, I don't particularly like this approach, but you can do it!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.