Jump to content

[SOLVED] Need Help: Input to change a variable.


ViciousC

Recommended Posts

Stuck What Im looking for is the input amount from the form to change the variable $amount.  this is what I have might be a little messy but everything works except the change.

 

function train2() {

global $userrow, $numqueries;

 

$good ="";

$bad ="";

$amount ="";

 

/********\

|Strength|

\********/

if (isset($_POST["Train1"])) {

 

$my_array = array(

"<font color=Lime>You train hard!</font>+.1125<br>", //0

"<font color=Lime>You train hard!</font>+.0381<br>", //1

                            "<font color=Red>Pulled a muscle</font>-.1427<br>",//2

                            "<font color=#808080>Your tired and give no effort!</font>+.0016<br>",//3

"<font color=Lime>You train hard!</font>+.1021<br>", //4

"<font color=Lime>You train hard!</font>+.0888<br>", //5

                            "<font color=Red>Pulled a muscle</font>-.0921<br>",//6

                            "<font color=#808080>Your tired and give no effort!</font>+.0004<br>",//7

"<font color=Lime>You train hard!</font>+.0221<br>", //8

"<font color=Lime>You train hard!</font>+.0377<br>", //9

                            "<font color=Red>Pulled a muscle</font>-.0925<br>",//10

                            "<font color=#808080>Your tired and give no effort!</font>+.0012<br>",//11

"<font color=Lime>You train hard!</font>+.0465<br>", //12

"<font color=Lime>You train hard!</font>+.0842<br>", //13

                            "<font color=Red>Pulled a muscle</font>-.1039<br>",//14

                            "<font color=#808080>Your tired and give no effort!</font>+.0004<br>"

);

 

for ($i=0; $i<=$amount; $i++){ 

$random = array_rand($my_array);

$parola .= $my_array[$random];

 

 

$gained = $good - $bad;

 

}

$title = "train";

$page = " <table width=100%><tr><td class=title align=center>Train Results</td></tr>";

$page .= " <tr><td>$parola</td></tr>";

$page .= " <tr><td>You Gained: $gained Strength</tr></table>";

$page .= "<center><a href=index.php?do=train>BACK</a></center>";

 

 

 

 

$updatequery = doquery("UPDATE {{table}} SET energy=energy-25, stamina=stamina-12 WHERE id='".$userrow["id"]."' LIMIT 1", "users");

 

} else {

$title = "train";

$page .= " <form action=\"index.php?do=train2\" method=\"post\">\n";

$page .= " <table width=90% border=1 align=center><tr><td align=center bgcolor=red colspan=2>TRAINING</td></tr>";

 

$page .= "<tr><td align=left>I want to train&nbsp&nbsp<input type=text name="" size=3 maxlength=3>&nbsp&nbsp times &nbsp&nbsp <input type=\"submit\" name=\"Train1\" value=\"SUBMIT\" /></td></tr>";

$page .= " </table><br /><br /> ";

$page .= "<center><a href=index.php?do=towninf>GO BACK</a></center>";

$page .= " </form>";

 

}

display($page, $title);

}

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.