douhan4243 2015-07-08 03:34
浏览 22

PHP - 同时回复HTML Div

I have this problem :

I have 2 php files > index.php and control.php.

Inside control.php are a variable called "$ControlNumber", this has the default value on 10 and a variable called "$Name"

Inside index.php I have a while with a condition ($ControlNumber < 10) and each time this it's executed , $ControlNumber its increased by 1.

The end of the code i made a div with the name of "$Name", but this doesn't work.

I execute the code by this way with a href link :

<?php
if ($_GET['run_func'] == 'yes') { 
include "control.php";
$ControlNumber--;
} else { 
echo '<a href="?run_func=yes">Press here 2 add a player</a>'; 
} 
?> 

Code inside the while :

<?php
include "control.php";
while($ControlNumber < 10) {
$ControlNumber++;
echo '<div id="Linea1" style="background-color#751313; color:white; font-       size:150%;";>' . $Name .'</div>';
$Name = "Used";
}
?>

Code of "Control.php"

<?php
$ControlNumber;
$ControlNumber = 10;
$Name = "John";
?>

I try a lot of different options when writing this code , but the "Text/Echo" doesn't work or appears.

  • 写回答

2条回答 默认 最新

  • dounieqi6959 2015-07-08 03:58
    关注

    this does not work because of the var $ControlNumber = 10
    and the while condition only run if this var less than 10
    try to declare this var $controlNumber = 0 may be this work ^^

    评论

报告相同问题?