<?php
if($ip == "ip1" or $ip =="ip2"){
$user = "someuser";
$pass = "somepass";
$pin = "somepin";
}
else
{
$user = "LOL";
$pass = "LOL";
$pin = "LOL";
}
?>
<div class="form-group">
<label for="exampleInputEmail1">Username</label>
<input type="email" name="email" class="form-control" placeholder="Email" value="<?php echo $user; ?>">
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="text" name="password" class="form-control" placeholder="Password" value="<?php echo $pass;?>">
</div>
<div class="form-group">
<label for="exampleInputPassword1">Pin</label>
<input type="text" name="password" class="form-control" placeholder="Password" value="<?php echo $pin;?>">
</div>
or
<?php
if($ip == "ip1" or $ip =="ip2"){
$user = "someuser";
$pass = "somepass";
$pin = "somepin";
}
else
{
$user = "LOL";
$pass = "LOL";
$pin = "LOL";
}
echo '<div class="form-group">
<label for="exampleInputEmail1">Username</label>
<input type="email" name="email" class="form-control" placeholder="Email" value="'.$user.'">
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="text" name="password" class="form-control" placeholder="Password" value="'.$pass.'">
</div>
<div class="form-group">
<label for="exampleInputPassword1">Pin</label>
<input type="text" name="password" class="form-control" placeholder="Password" value="'.$pin.'">
</div>';
?>
1
solved PHP – Echo doing nothing in if statement