
IF
A=1
Then
<html code here>
A=2
<html code here>
Kind of like that, i think its javascript but i havent learned that yet

Thanks in advance


Posted 10 April 2011 - 02:23
Posted 10 April 2011 - 08:12
<?php if($a == 1){ ?>
<!-- HTML GOES HERE -->
<?php }elseif($a == 2){ ?>
<!-- SOME OTHER HTML GOES HERE -->
<?php } ?>
Edited by Bob, 10 April 2011 - 08:14.
Posted 10 April 2011 - 18:44
Edited by Genrail, 10 April 2011 - 18:46.
Posted 11 April 2011 - 18:27
<?php phpinfo(); ?>
<?php
// Assign a random number to the variable 'a' between 1 and 5
$a = rand(1, 5);
// Determine which piece of HTML to display
if($a == 1){
?><!-- HTML CODE 1 --><?php
}elseif($a == 2){
?><!-- HTML CODE 2 --><?php
}elseif($a == 3){
?><!-- HTML CODE 3 --><?php
}elseif($a == 4){
?><!-- HTML CODE 4 --><?php
}else{
?><!-- HTML CODE 5 --><?php
}
?>
<script type="text/javascript">
// Math.random() picks a random number between 0 and 1
// Times that number by 5, and round downwards to get a random number between 0 and 4
var a = Math.floor(Math.random()*5);
// Determine which piece of HTML to write to the body
if(a == 0){
document.write('HTML CODE 1');
}else if(a == 1){
document.write('HTML CODE 2');
}else if(a == 2){
document.write('HTML CODE 3');
}else if(a == 3){
document.write('HTML CODE 4');
}else{
document.write('HTML CODE 5');
}
</script>
Edited by Bob, 11 April 2011 - 18:28.
0 members, 1 guests, 0 anonymous users