Correct my codes please.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • infested13
    replied
    thanks for your replies. i already fixed it.

    PHP Code:
    if ( $level == "1" && $char == "warrior" ) 

    Leave a comment:


  • GumSlone
    replied
    there should be 2 equal and & signs, everywhere

    PHP Code:
    if ($_POST['level'] == "1" && $_POST['char'] == "warrior") 

    Leave a comment:


  • infested13
    replied
    Originally posted by ori View Post
    whats the error/glitch ?
    if i type 2 here:

    PHP Code:
    <form action="experience.php" method="post"> 
    <
    b>Enter Level</b><br><br> 
    <
    input type="text" name="level" maxlength="2" size="3"><br><br> 
    <
    input type="radio" name="char" value="warrior"> Warrior 
    <br> 
    <
    input type="radio" name="char" value="wizard"> Wizard 
    <br><br> 
    <
    input type="submit" value="Calculate"> 
    </
    form> 
    the result is:

    PHP Code:
    if ($_POST['level'] = "1" & $_POST['char'] = "warrior"){ 
       echo 
    "<b>Experience Needed:</b><br>"; 
       echo 
    "0<br>"; 
       echo 
    "<b>Health:</b><br>"; 
       echo 
    "100"; 
    even if the code for two is

    PHP Code:
    else if ($_POST['level'] = "2" & $_POST['char'] = "warrior"){ 
       echo 
    "<b>Experience Needed:</b><br>"; 
       echo 
    "10<br>"; 
       echo 
    "<b>Health:</b><br>"; 
       echo 
    "110"; 

    Leave a comment:


  • ori
    replied
    whats the error/glitch ?

    Leave a comment:


  • infested13
    started a topic Correct my codes please.

    Correct my codes please.

    hello seniors.
    im making an experience calculator for an online game.

    please help me with this script.
    i cant output the correct data.

    PHP Code:
    <?
    include("../include/session.php");
    include("../include/protect.php");
    ?>
    <html>
    <head>
    <title>Exp Generator</title>
    <link rel="stylesheet" type="text/css" href="/1.css">
    <link rel="shortcut icon" href="/tibia.ico">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="description" content="Armada TibiaME - One of the best TibiaME fansite!">
    <meta name="keywords" content="tibia, tibiame, fansite, microspec, armada">
    </head>
    <div align="center">
    <font size="1" face="Century Gothic">
    <img src="/logo.png"/><br><br>
    <body>

    <form action="experience.php" method="post">
    <b>Enter Level</b><br><br>
    <input type="text" name="level" maxlength="2" size="3"><br><br>
    <input type="radio" name="char" value="warrior"> Warrior
    <br>
    <input type="radio" name="char" value="wizard"> Wizard
    <br><br>
    <input type="submit" value="Calculate">
    </form>

    <a href="/home.php">Main Menu</a><br><br>
    </div>
    </body>
    </html>
    example of experience.php
    PHP Code:
    <?
    include("../include/session.php");
    include("../include/protect.php");
    ?>
    <html>
    <head>
    <title>Exp Generator</title>
    <link rel="stylesheet" type="text/css" href="/1.css">
    <link rel="shortcut icon" href="/tibia.ico">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="description" content="Armada TibiaME - One of the best TibiaME fansite!">
    <meta name="keywords" content="tibia, tibiame, fansite, microspec, armada">
    </head>
    <div align="center">
    <font size="1" face="Century Gothic">
    <img src="/logo.png"/><br><br>
    <body>

    <?
    if ($_POST['level'] = "1" & $_POST['char'] = "warrior"){
       echo "<b>Experience Needed:</b><br>";
       echo "0<br>";
       echo "<b>Health:</b><br>";
       echo "100";
    }
    else if ($_POST['level'] = "1" & $_POST['char'] = "wizard"){
       echo "<b>Experience Needed:</b><br>";
       echo "0<br>";
       echo "<b>Health:</b><br>";
       echo "100";
    }
    else if ($_POST['level'] = "2" & $_POST['char'] = "warrior"){
       echo "<b>Experience Needed:</b><br>";
       echo "10<br>";
       echo "<b>Health:</b><br>";
       echo "110";
    }
    else if ($_POST['level'] = "2" & $_POST['char'] = "wizard"){
       echo "<b>Experience Needed:</b><br>";
       echo "10<br>";
       echo "<b>Health:</b><br>";
       echo "104";
    }
    ?>

    <br><br>
    <a href="/home.php">Main Menu</a><br><br>
    </div>
    </body>
    </html>
    hahah. dont laugh. im just a beginner, hmm. whats wrong with my experience.php. it
Working...
X