Jump to content

twilitegxa

Members
  • Posts

    1,020
  • Joined

  • Last visited

Posts posted by twilitegxa

  1. Well, i already have the text-align set to center on the table cell, so I can't figure out how to do both, so I guess I will close this topic as solved and give up on doing it. What I wanted to do was have the cell centered as well as have the numbers being displayed in it aligned to the decimal:

     

    So instead of this -

     

    4

    5

    10

     

    I'd have:

     

      4

      5

    10

     

    It is sort of hard to line up, but I think you can see what I mean.

  2. I see what you did, but I can get it to work for this calculation:

     

    $sub_attributes_points = ($sub_attribute_names_points * $sub_attributes_level_id);

     

    I tried this:

     

    $sub_attributes_points = number_format ($sub_attributes_points , 0 , "." , ",");

     

    But nothing happened. What am I doing wrong?

  3. Is there a way to code this to where the number line up at the decimals? I was reading about the number_format function, but I can't get it to work right. Can anyone help? Here is the code I wish to use it on:

     

    <?php
    $get_sub_attributes = "select * from scout_sub_attributes where identity = '$identity'";
    $get_sub_attributes_res = mysql_query($get_sub_attributes, $conn) or die(mysql_error());
    
    while ($sub_attributes_info = mysql_fetch_array($get_sub_attributes_res)) {
    $sub_attributes_id = $sub_attributes_info['id'];
    $sub_attributes_identity = $sub_attributes_info['identity'];
    $sub_attributes_attribute_id = $sub_attributes_info['sub_attribute_id'];
    $sub_attributes_level_id = $sub_attributes_info['level_id'];
    $sub_attributes_notes = $sub_attributes_info['notes'];
    
    $get_sub_attribute_names = "select * from sub_attributes where id = '$sub_attributes_attribute_id'";
    $get_sub_attribute_names_res = mysql_query($get_sub_attribute_names, $conn) or die(mysql_error());
    
    while ($sub_attribute_names_info = mysql_fetch_array($get_sub_attribute_names_res)) {
    $sub_attribute_names_id = $sub_attribute_names_info['id'];
    $sub_attribute_names_attribute = $sub_attribute_names_info['sub_attribute'];
    $sub_attribute_names_points = $sub_attribute_names_info['points'];
    $sub_attributes_points = ($sub_attribute_names_points * $sub_attributes_level_id);
    
    $display_block .= "
    <tr>
    <td class=indent>$sub_attribute_names_attribute</td>";
    
    if ($sub_attributes_level_id == null) {
    $display_block .= "$sub_attributes_level_id";
    } else {
    $display_block .= "
    <td class=align_levels>$sub_attributes_level_id</td>
    <td class=align_levels>$sub_attributes_points</td>
    </tr>";
    }
    ?>
    

     

    The variables I want decimal aligned are $sub_attributes_level_id and $sub_attributes_points. How can I do this?

  4. Well, I did this and it worked:

     

    $get_sub_attributes = "select * from scout_sub_attributes where identity = '$identity'";
    $get_sub_attributes_res = mysql_query($get_sub_attributes, $conn) or die(mysql_error());
    
    while ($sub_attributes_info = mysql_fetch_array($get_sub_attributes_res)) {
    $sub_attributes_id = $sub_attributes_info['id'];
    $sub_attributes_identity = $sub_attributes_info['identity'];
    $sub_attributes_attribute_id = $sub_attributes_info['sub_attribute_id'];
    $sub_attributes_level_id = $sub_attributes_info['level_id'];
    $sub_attributes_notes = $sub_attributes_info['notes'];
    
    $get_sub_attribute_names = "select * from sub_attributes where id = '$sub_attributes_attribute_id'";
    $get_sub_attribute_names_res = mysql_query($get_sub_attribute_names, $conn) or die(mysql_error());
    
    while ($sub_attribute_names_info = mysql_fetch_array($get_sub_attribute_names_res)) {
    $sub_attribute_names_id = $sub_attribute_names_info['id'];
    $sub_attribute_names_attribute = $sub_attribute_names_info['sub_attribute'];
    $sub_attribute_names_points = $sub_attribute_names_info['points'];
    $sub_attributes_points = ($sub_attribute_names_points * $sub_attributes_level_id);
    
    $display_block .= "
    <tr>
    <td class=indent>$sub_attribute_names_attribute</td>";
    
    if ($sub_attributes_level_id == null) {
    $display_block .= "$sub_attributes_level_id";
    } else {
    $display_block .= "
    <td class=align_levels>$sub_attributes_level_id</td>
    <td class=align_levels>$sub_attributes_points</td>
    </tr>";
    }
    

     

    I just added that if statement and it fixed the problem. Thanks for all the help!

  5. I figured it out! I moved the items statement to be inside of the sub_attributes loop, and now it works. Here is the code:

     

    $get_sub_attributes = "select * from scout_sub_attributes where identity = '$identity'";
    $get_sub_attributes_res = mysql_query($get_sub_attributes, $conn) or die(mysql_error());
    
    while ($sub_attributes_info = mysql_fetch_array($get_sub_attributes_res)) {
    $sub_attributes_id = $sub_attributes_info['id'];
    $sub_attributes_identity = $sub_attributes_info['identity'];
    $sub_attributes_attribute_id = $sub_attributes_info['sub_attribute_id'];
    $sub_attributes_level_id = $sub_attributes_info['level_id'];
    $sub_attributes_notes = $sub_attributes_info['notes'];
    
    $get_sub_attribute_names = "select * from sub_attributes where id = '$sub_attributes_attribute_id'";
    $get_sub_attribute_names_res = mysql_query($get_sub_attribute_names, $conn) or die(mysql_error());
    
    while ($sub_attribute_names_info = mysql_fetch_array($get_sub_attribute_names_res)) {
    $sub_attribute_names_id = $sub_attribute_names_info['id'];
    $sub_attribute_names_attribute = $sub_attribute_names_info['sub_attribute'];
    $sub_attribute_names_points = $sub_attribute_names_info['points'];
    $sub_attributes_points = ($sub_attribute_names_points * $sub_attributes_level_id);
    
    $display_block .= "
    <tr>
    <td class=indent>$sub_attribute_names_attribute</td>
    <td class=align_levels>$sub_attributes_level_id</td>
    <td class=align_levels>$sub_attributes_points</td>
    </tr>";
    
    //gather attacks
    $get_items = "select * from items where identity = '$identity' order by level asc";
    $get_items_res = mysql_query($get_items, $conn) or die(mysql_error());
    
    while ($items_info = mysql_fetch_array($get_items_res)) {
    $item_id = $items_info['id'];
    $item_identity = $items_info['identity'];
    $items = $items_info['item'];
    $item_desc = $items_info['desc'];
    $item_level = $items_info['level'];
    $item_points = ($sub_attribute_names_points * $item_level);
    
    if ($sub_attribute_names_attribute == 'Item Of Power') {
    $display_block .= "
    <tr>
    <td class=indent2>- $items</td>
    <td class=align_levels>$item_level</td>
    <td class=align_levels>$item_points</td>
    </tr>
    <tr>";
    
    }
    }
    
    }
    }
    
    
    
    //gather attacks
    $get_attacks = "select * from attacks where identity = '$identity' order by level desc";
    $get_attacks_res = mysql_query($get_attacks, $conn) or die(mysql_error());
    
    while ($attacks_info = mysql_fetch_array($get_attacks_res)) {
    $attack_id = $attacks_info['id'];
    $attack_identity = $attacks_info['identity'];
    $attack = $attacks_info['attack'];
    $primary = $attacks_info['primary_attack'];
    $secondary = $attacks_info['secondary_attack'];
    $attack_level = $attacks_info['level'];
    $attack_points = ($sub_attribute_names_points * $attack_level);
    
    //checks for primary and secondary attacks
    if($secondary == 1) $attack_points = 2;
    elseif($primary == 0 && $secondary == 0) $attack_points = 1;
    
    if ($sub_attribute_names_attribute == 'Sailor Scout Attack') {
    $display_block .= "
    <tr>
    <td class=indent2>- $attack</td>
    <td class=align_levels>$attack_level</td>
    <td class=align_levels>$attack_points</td>
    </tr>
    <tr>";
    
    }
    }
    

     

    Thanks for all the help everyone!

  6. I tried moving the items above the attacks statement, and then commentign out the if statement to see what was printing and how it was printing, and all of the items get listed like I want them to, except theya re getting listed with the attacks, under the Sailor Scout Attack. Here is the code:

     

    $get_sub_attributes = "select * from scout_sub_attributes where identity = '$identity'";
    $get_sub_attributes_res = mysql_query($get_sub_attributes, $conn) or die(mysql_error());
    
    while ($sub_attributes_info = mysql_fetch_array($get_sub_attributes_res)) {
    $sub_attributes_id = $sub_attributes_info['id'];
    $sub_attributes_identity = $sub_attributes_info['identity'];
    $sub_attributes_attribute_id = $sub_attributes_info['sub_attribute_id'];
    $sub_attributes_level_id = $sub_attributes_info['level_id'];
    $sub_attributes_notes = $sub_attributes_info['notes'];
    
    $get_sub_attribute_names = "select * from sub_attributes where id = '$sub_attributes_attribute_id'";
    $get_sub_attribute_names_res = mysql_query($get_sub_attribute_names, $conn) or die(mysql_error());
    
    while ($sub_attribute_names_info = mysql_fetch_array($get_sub_attribute_names_res)) {
    $sub_attribute_names_id = $sub_attribute_names_info['id'];
    $sub_attribute_names_attribute = $sub_attribute_names_info['sub_attribute'];
    $sub_attribute_names_points = $sub_attribute_names_info['points'];
    $sub_attributes_points = ($sub_attribute_names_points * $sub_attributes_level_id);
    
    $display_block .= "
    <tr>
    <td class=indent>$sub_attribute_names_attribute</td>
    <td class=align_levels>$sub_attributes_level_id</td>
    <td class=align_levels>$sub_attributes_points</td>
    </tr>";
    
    }
    }
    
    //gather items of power
    $get_items = "select * from items where identity = '$identity'";
    $get_items_res = mysql_query($get_items, $conn) or die(mysql_error());
    
    while ($items_info = mysql_fetch_array($get_items_res)) {
    $items_id = $items_info['id'];
    $items_identity = $items_info['identity'];
    $item = $items_info['item'];
    $item_desc = $items_info['desc'];
    $item_level = $items_info['level'];
    $item_points = ($sub_attribute_names_points * $item_level);
    
    //if ($sub_attribute_names_attribute == 'Item Of Power') {
    $display_block .= "
    <tr>
    <td class=indent2>- $item</td>
    <td class=align_levels>$item_level</td>
    <td class=align_levels>$item_points</td>
    </tr>
    <tr>";
    
    }
    //}
    
    //gather attacks
    $get_attacks = "select * from attacks where identity = '$identity' order by level desc";
    $get_attacks_res = mysql_query($get_attacks, $conn) or die(mysql_error());
    
    while ($attacks_info = mysql_fetch_array($get_attacks_res)) {
    $attack_id = $attacks_info['id'];
    $attack_identity = $attacks_info['identity'];
    $attack = $attacks_info['attack'];
    $primary = $attacks_info['primary_attack'];
    $secondary = $attacks_info['secondary_attack'];
    $attack_level = $attacks_info['level'];
    $attack_points = ($sub_attribute_names_points * $attack_level);
    
    //checks for primary and secondary attacks
    if($secondary == 1) $attack_points = 2;
    elseif($primary == 0 && $secondary == 0) $attack_points = 1;
    
    if ($sub_attribute_names_attribute == 'Sailor Scout Attack') {
    $display_block .= "
    <tr>
    <td class=indent2>- $attack</td>
    <td class=align_levels>$attack_level</td>
    <td class=align_levels>$attack_points</td>
    </tr>
    <tr>";
    
    }
    }
    

     

    How can I fix my if statement to make it print out the items under the Item Of Power?

  7. I have the following code:

     

    $get_sub_attributes = "select * from scout_sub_attributes where identity = '$identity'";
    $get_sub_attributes_res = mysql_query($get_sub_attributes, $conn) or die(mysql_error());
    
    while ($sub_attributes_info = mysql_fetch_array($get_sub_attributes_res)) {
    $sub_attributes_id = $sub_attributes_info['id'];
    $sub_attributes_identity = $sub_attributes_info['identity'];
    $sub_attributes_attribute_id = $sub_attributes_info['sub_attribute_id'];
    $sub_attributes_level_id = $sub_attributes_info['level_id'];
    $sub_attributes_notes = $sub_attributes_info['notes'];
    
    $get_sub_attribute_names = "select * from sub_attributes where id = '$sub_attributes_attribute_id'";
    $get_sub_attribute_names_res = mysql_query($get_sub_attribute_names, $conn) or die(mysql_error());
    
    while ($sub_attribute_names_info = mysql_fetch_array($get_sub_attribute_names_res)) {
    $sub_attribute_names_id = $sub_attribute_names_info['id'];
    $sub_attribute_names_attribute = $sub_attribute_names_info['sub_attribute'];
    $sub_attribute_names_points = $sub_attribute_names_info['points'];
    $sub_attributes_points = ($sub_attribute_names_points * $sub_attributes_level_id);
    
    $display_block .= "
    <tr>
    <td class=indent>$sub_attribute_names_attribute</td>
    <td class=align_levels>$sub_attributes_level_id</td>
    <td class=align_levels>$sub_attributes_points</td>
    </tr>";
    
    }
    }
    

     

    What I want to do, is if there is a value in the notes field of the scout_sub_attributes table (in other words, if it is not null), then I want to display a subscript (1, 2, 3...etc) after the sub_attribute_names_attribute. I also have this code:

     

    //gather attributes and sub-attributes notes
    
    $get_sub_notes = "select notes from scout_sub_attributes where identity = '$identity' and notes IS NOT NULL";
    $get_sub_notes_res = mysql_query($get_sub_notes, $conn) or die(mysql_error());
    
    while ($sub_notes_info = mysql_fetch_array($get_sub_notes_res)) {
    $sub_notes = $sub_notes_info['notes'];
    
    $display_block.= "
    <li>$sub_notes</li>";
    
    }
    

     

    And I want the subscript from above to match the listed item from this code above. Is this possible? And if so, how could I do it? Does it make sense what I want to do? Here is an example:

     

    Combined Attack1

     

    Then later on down the page:

     

    1. some text from the sub_attribute_notes for Combined Attack

     

     

     

     

  8. I have the following code:

     

    $display_block .= "</table></td>
    <td width=50% valign=top>
    <table>
    <tr>
    <td><h1>Attribute/Sub-Attribute Notes</h1></td></tr>
    <tr>
    <td>
    <ol>";
    
    //gather attributes and sub-attributes notes
    
    $get_sub_notes = "select notes from scout_sub_attributes where identity = '$identity'";
    $get_sub_notes_res = mysql_query($get_sub_notes, $conn) or die(mysql_error());
    
    while ($sub_notes_info = mysql_fetch_array($get_sub_notes_res)) {
    $sub_notes = $sub_notes_info['notes'];
    
    $display_block.= "
    <li>$sub_notes</li>";
    
    }
    
    $display_block .= "</ol></table></td></tr></table>";
    

     

    How can I only display the records from the database in this list that have a value? There are several empty values in the table, and I don't want to display these in the list. Can I use an if statement, or is there some other way?[/code]

  9. How could I alter my page to include the login script on it? Like, if they want to view the page listed above, I want it to display, "You must log in to view this page.", and display the log in information (enter username and password input boxes like on my login.php). Then, after they log in, to show that page, but without the login input boxes and to show that they are logged in on the right. Right now how I have it is the page redirects them to to the separate login page, then when they log in, it redirects them to the account.php page. I want to eliminate then need to redirect. If I can just do what I explained all on the same page in a single script, then I won't need a redirect. Can anyone help me do it? I'm not very good with php yet. :-(

  10. It is giving this error and showing the login page, and showing the user logged in but still asking them to log in:

     

    Notice: Undefined index: HTTP_REFERER in C:\wamp\www\login.php on line 24

     

    This i what I changed:

     

    <?php
    session_start();
    
    $ref = $_SERVER['HTTP_REFERER']; // Location of the user area
    // Connect to MySQL database:
    $access = mysql_connect('localhost','root','') or die ('Could not connect to database');
    mysql_select_db('smrpg',$access) or die ('Could not select table');
    # #
    $error = array();
    if(isset($_GET['action'])) {
    switch($_GET['action']) {
    case 'logoff':
    unset($_SESSION['loggedIn']);
    array_push($error, 'You were logged off.');
    break;
    }
    }
    if(!$error) {
    if(empty($_POST['username'])) { array_push($error, 'You didn\'t supply a username'); }
    if(empty($_POST['password'])) { array_push($error, 'You didn\'t supply a password'); }
    }
    if(!$error){
    $result = @mysql_query('SELECT username, email, name FROM `users` WHERE username = \''.mysql_real_escape_string($_POST['username']).'\' AND password = \''.mysql_real_escape_string(md5($_POST['password'])).'\'');
    if($row = @mysql_fetch_array($result)) {
    $_SESSION['loggedIn'] = true;
    $_SESSION['userName'] = $row['username']; 
    $_SESSION['userMail'] = $row['email'];
    $_SESSION['name'] = $row['name'];
    header( 'refresh: 3; url='.$ref);
    
    }else{
    array_push($error, 'The username or password you provided were not correct');
    }
    }
    ?>
    

  11. How can I change my page to take out the extra step of directing the user to the login page? I want to use a redirect script that redirects the user to the previous page they were at before being asked to log in, but I'm not having very much luck. Right now, my login page redirects them to a specific page (account.php), but I don't want to do that anymore. Now I want it to just ask them to log in and then redirect them back to the page they weer at when they were asked to log in. Can anyone tell me how I can alter my script to do this?

     

    Here is my login page:

     

    <?php
    
    //Access Tracking Snippet
    
    //set up static variables
    $page_title = "login.php";
    $user_agent = getenv("HTTP_USER_AGENT");
    $date_accessed = date("Y-m-d");
    
    //connect to server and select database
    $conn = mysql_connect("localhost", "root", "")
    or die(mysql_error());
    $db = mysql_select_db("smrpg", $conn) or die(mysql_error());
    
    //create and issue query
    $sql = "insert into access_tracker values
    ('', '$page_title', '$user_agent', '$date_accessed')";
    mysql_query($sql,$conn);
    ?>
    
    <?php
    session_start();
    
    $user_area_location = 'account.php'; // Location of the user area
    // Connect to MySQL database:
    $access = mysql_connect('localhost','root','') or die ('Could not connect to database');
    mysql_select_db('smrpg',$access) or die ('Could not select table');
    # #
    $error = array();
    if(isset($_GET['action'])) {
    switch($_GET['action']) {
    case 'logoff':
    unset($_SESSION['loggedIn']);
    array_push($error, 'You were logged off.');
    break;
    }
    }
    if(!$error) {
    if(empty($_POST['username'])) { array_push($error, 'You didn\'t supply a username'); }
    if(empty($_POST['password'])) { array_push($error, 'You didn\'t supply a password'); }
    }
    if(!$error){
    $result = @mysql_query('SELECT username, email, name FROM `users` WHERE username = \''.mysql_real_escape_string($_POST['username']).'\' AND password = \''.mysql_real_escape_string(md5($_POST['password'])).'\'');
    if($row = @mysql_fetch_array($result)) {
    $_SESSION['loggedIn'] = true;
    $_SESSION['userName'] = $row['username']; 
    $_SESSION['userMail'] = $row['email'];
    $_SESSION['name'] = $row['name'];
    header('Location: '.$user_area_location);
    die('<a href="'.$user_area_location.'">Go to your user account</a>');
    }else{
    array_push($error, 'The username or password you provided were not correct');
    }
    }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Sailor Moon RPG - Login</title>
    <!-- Source File -->
    <style type="text/css" media="screen">
    /*<![CDATA[*/
    @import url(global.css); 
    /*]]>*/
    </style>
    </head>
    <body>
    <!-- HEADER -->
    <h1 class="logo">Sailor Moon RPG</h1>
    <!-- /HEADER -->
    <?php include("topnav.php"); ?>
    <div id="main">
    <?php include("includes/log.php"); ?>
    <?php include("mainnav.php"); ?>
    <table cellspacing="2" cellpadding="0" border="0">
    <form method="post" action="login.php">
    <?php if(isset($error) && $error) { ?>
    <tr>
    <td colspan="2">
    <ul><?php foreach($error as $key => $value) echo '<li>'.$value.'</li>'; ?></ul>
    </td>
    </tr><?php } ?>
    <tr>
    <td>Username:</td>
    <td><input type="text" name="username" /></td>
    </tr>
    <tr>
    <td>Password:</td>
    <td><input type="password" name="password" /></td>
    </tr>
    <tr>
    <td> </td>
    <td><input type="submit" name="submit" value="Login!" /> <a href="forgot.php">I forgot my username or password</a></td>
    
    </tr>
    </form>
    </table>
    </div>
    <?php include("bottomnav.php"); ?>
    <!-- FOOTER -->
    <div id="footer_wrapper">
    <div id="footer">
    <p>Sailor Moon and all characters are<br>
    trademarks of Naoko Takeuchi.</p>
    <p>Copyright © 2009 Liz Kula. All rights reserved.<br>
    A product of <a href="#" target="_blank">Web Designs By Liz</a> systems.</p>
    <div id="foot-nav"><!-- <ul>
    <li><a href="http://validator.w3.org/check?uri=http://webdesignsbyliz.com/digital/index.php" target="_blank"><img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a></li>
    <li><a href="http://jigsaw.w3.org/css-validator/validator?uri=http://webdesignsbyliz.com/digital/global.css" target="_blank"><img class="c2" src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS!" /></a></li>
    </ul> --></div>
    </div>
    </div>
    <!-- /FOOTER -->
    </body>
    </html>
    

     

    And here is a page that requires the user to be logged in:

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html lang="en">
    <?php
    
    session_start();
    
    if(!isset($_SESSION['loggedIn'])) {
    header("Location: login.php");
    }
    
    //Access Tracking Snippet
    
    //set up static variables
    $page_title = "creationform.php";
    $user_agent = getenv("HTTP_USER_AGENT");
    $date_accessed = date("Y-m-d");
    
    //connect to server and select database
    $conn = mysql_connect("localhost", "root", "")
            or die(mysql_error());
    $db = mysql_select_db("smrpg", $conn) or die(mysql_error());
    
    //create and issue query
    $sql = "insert into access_tracker values
            ('', '$page_title', '$user_agent', '$date_accessed')";
    mysql_query($sql,$conn);
    
    $gender = (!empty($_POST['gender']))?$_POST['gender']:""; //Male or female?
    $status = (!empty($_POST['status']))?$_POST['status']:""; //Hero or villain?
    
    if($status == "villain"){
    if($gender == "male") {
    	//You are a male villain
    	header("Location: mdark_warrior.php");
    	exit;
    	}elseif($gender == "female"){
    	//You are a female villain
    	header("Location: fdark_warrior.php");
    	exit;
    	}
    }elseif($status == "hero"){
            if($gender == "male"){
                    //You are a male hero!
                    header("Location: knight.php");
            exit;
            }elseif($gender == "female"){
                    //You are a female hero!
                    header("Location: scout.php");
            exit;
            }
    }
    ?>
    <head>
    <title>Sailor Moon RPG - Character Creation - Step 2: Character Outline</title>
    
    <style type="text/css" media="screen">
    /*<![CDATA[*/
    @import url(global.css); 
    /*]]>*/
    </style>
    </head>
    <body>
    <!-- HEADER -->
    <h1 class="logo">Sailor Moon RPG</h1>
    <!-- /HEADER -->
    <?php include("topnav.php"); ?>
    <div id="main">
    <?php include("includes/log.php"); ?>
    <?php include("mainnav.php"); ?>
    <h1>Step 2: Character Outline - Creation</h1>
    <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
    <table>
    <tr>
    <td>Would you like to create a:</td>
    <td><input type="radio" name="status" value="hero"> Hero or a <input type="radio" name="status" value="villain" class="input1"> Villain</td>
    </tr>
    <tr>
    <td></td>
    <td><input type="radio" name="gender" value="female"> Female or <input type="radio" name="gender" value="male"> Male</td>
    </tr>
    </table>
    <br>
    <input type="submit" name="submit" value="Create Character" class="button1"> <input type="reset" name="reset" value="Reset"></form><br>
    
    Or, would you like to use an <a href="existing.php">existing character</a>?
    </div>
    <?php include("bottomnav.php"); ?>
    <!-- FOOTER -->
    <div id="footer_wrapper">
    <div id="footer">
    <p>Sailor Moon and all characters are<br>
    trademarks of Naoko Takeuchi.</p>
    <p>Copyright © 2009 Liz Kula. All rights reserved.<br>
    A product of <a href="#" target="_blank">Web Designs By Liz</a> systems.</p>
    <div id="foot-nav"><!-- <ul>
    <li><a href="http://validator.w3.org/check?uri=http://webdesignsbyliz.com/digital/index.php" target="_blank"><img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a></li>
    <li><a href="http://jigsaw.w3.org/css-validator/validator?uri=http://webdesignsbyliz.com/digital/global.css" target="_blank"><img class="c2" src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS!" /></a></li>
    </ul> --></div>
    </div>
    </div>
    <!-- /FOOTER -->
    </body>
    </html>
    

  12. I have this fader script that fades in and out the image when the link is clicked. Is there a way to have the image faded out when the page is loaded so that when the link is clicked the image gets faded in? Here is what I have:

     

    Javascript:

    <script>
    var TimeToFade = 1000.0;
    
    function fade(eid)
    {
      var element = document.getElementById(eid);
      if(element == null)
        return;
       
      if(element.FadeState == null)
      {
        if(element.style.opacity == null
            || element.style.opacity == ''
            || element.style.opacity == '1')
        {
          element.FadeState = 2;
        }
        else
        {
          element.FadeState = -2;
        }
      }
       
      if(element.FadeState == 1 || element.FadeState == -1)
      {
        element.FadeState = element.FadeState == 1 ? -1 : 1;
        element.FadeTimeLeft = TimeToFade - element.FadeTimeLeft;
      }
      else
      {
        element.FadeState = element.FadeState == 2 ? -1 : 1;
        element.FadeTimeLeft = TimeToFade;
        setTimeout("animateFade(" + new Date().getTime() + ",'" + eid + "')", 33);
      }  
    }
    
    function animateFade(lastTick, eid)
    {  
      var curTick = new Date().getTime();
      var elapsedTicks = curTick - lastTick;
    
      var element = document.getElementById(eid);
    
      if(element.FadeTimeLeft <= elapsedTicks)
      {
        element.style.opacity = element.FadeState == 1 ? '1' : '0';
        element.style.filter = 'alpha(opacity = '
            + (element.FadeState == 1 ? '100' : '0') + ')';
        element.FadeState = element.FadeState == 1 ? 2 : -2;
        return;
      }
    
      element.FadeTimeLeft -= elapsedTicks;
      var newOpVal = element.FadeTimeLeft/TimeToFade;
      if(element.FadeState == 1)
        newOpVal = 1 - newOpVal;
    
      element.style.opacity = newOpVal;
      element.style.filter = 'alpha(opacity = ' + (newOpVal*100) + ')';
    
      setTimeout("animateFade(" + curTick + ",'" + eid + "')", 33);
    }
    </script>
    

     

    Body:

    <div id="fadeBlock" title="fadeBlock">
    <img src="images/brianna_kainan.jpg" width="500" height="400" id="kula" title="kula" /><br />
    <p><b>My kids, Brianna and Kainan</b></p>
    </div>
    Click here to <a href="#" onclick="fade('fadeBlock')">Fade In/Fade Out</a>
    

     

    How can I do this?

     

  13. Echo it where? It is listing all of the records in the sub_attributes_names table and the previous if statement lists the attacks if the sub_attribute_name equals "Sailor Scout Attack" so I can't see why it won't pull the items if the sub_attribute_name equals "Item Of Power". Have I typed something wrong that anyone can see?

  14. I received this error when I changed that:

     

    Parse error: parse error in C:\wamp\www\showprofile_scouts.php on line 370

     

    Isn't it a problem using the <?php ?> tags within this code because it is already in php tags? How else can I do it? I had to do the same thing before, but I used an if statement, but I'm not sure how I'd do it here. Here is one I used before:

     

    if($health == 0 || $health == '0' || $health == null){$GLOBALS['health'] = "";}

     

    But since this one isn't from a value in the table, I don't know how i'd write it. Can anyone help?

×
×
  • 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.