Jump to content

snoreboy01

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

snoreboy01's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you for all your replies. When I click my button to submit, I want it to refresh the current page with the new data. (The form calls the same page.) The problem I had was when I made changes to the code, I didn't change the $a_row to the new name of $num_rows_1 also during my changes, I used mysql_num_rows again instead of mysql_fetch_array. Changed those 2 things and all works fine now. I didn't know about error_reporting(E_ALL), I thought the browser reported all errors when the page was rendered. I shall include that in from now on, thank you. The <input type="submit" value="Choose!"> being after the <options> and before the </select> tag works fine. Thank you all.
  2. Hi there all and first thing, thank you for any help you can give on this. I am making a game with php and I am still new to php. I have made a View Fighter page so you can view different fighters. This is done by a dynamic drop down box that gets the list of fighters names from the database and creates the drop down box. Then you can choose which fighter to view, it stays ont he same page but the data is up dated with the data from the fighter you have chosen. The drop down has the list of fighters, but when i choose, nothing happens. ---- code ---- viewFighter.php <?php session_start(); require "db_connect.php"; /* To get form data and set what fighter name to get the data for. */ $FName = $_POST['fighter']; /* Qry 1 is getting the fighter details based on unique name. */ $qry1 = mysql_query( "SELECT * FROM fighters where fighterName='$FName'"); $num_rows_1 = mysql_num_rows( $qry1 ); /* Qry 2 is unique names for options values. */ $qry2 = "SELECT fighterName FROM fighters order by fighterName asc"; $result2 =mysql_query($qry2); $num_rows_2 = mysql_num_rows( $result2 ); $NickName = $a_row["fighterName"]; $RealName = $a_row["fullName"]; $gender = $a_row["gender"]; $Tech= $a_row["tech"]; $Type=$a_row["charType"]; $Height= $a_row["height"]; $Weight=$a_row["weight"]; $Age = $a_row["age"]; $Rank = $a_row["rank"]; $Concept = $a_row["concept"]; $Signature = $a_row["signature"]; $STR = $a_row["Fstr"]; $DEX =$a_row["Fdex"]; $STA = $a_row["Fsta"]; $CHA = $a_row["Fcha"]; $MAN = $a_row["Fman"]; $APP = $a_row["Fapp"]; $PER = $a_row["Fper"]; $INT = $a_row["Fint"]; $WIT = $a_row["Fwit"]; $imageLocation = "/Fighters/chars/"; $imageName = "{$NickName}.jpg"; $imageFinal = "{$imageLocation}{$imageName}"; ?> <html> <head> <title>Fighter Details</title> </head> <body> <br> <a href="/Fighters/index.php">Home!</a> <a href="createFighter.php">Create Fighter!</a> <br><br> <h4><?php echo $NickName ?></h4> <br><br> <form method="post" action="viewFighter.php"> Choose a Fighter! <select name="fighter"> <?php while($rows_2=mysql_fetch_array( $result2 )) { ?> <option value="<?php echo $rows_2['fighterName']?>"><?php echo $rows_2['fighterName']?></option> <? } ?> <input type="submit" value="Choose!"> </select> </form> <br> <table border="1"> <tr> <table border="1"> <tr> <td>Nick Name:</td> <td width=20%><?php echo $NickName?></td> <td>Technique:</td> <td><?php echo $Tech?></td> <td rowspan="7" colspan="3" width=25%><img src="<?php echo $imageFinal; ?>" height="200"/></td> </tr> <tr> <td>Real Name:</td> <td><?php echo $RealName?></td> <td idth=20%>Gender:</td> <td><?php echo $gender ?></td> </tr> <tr> <td>Height:</td> <td><?php echo $Height?> ft</td> <td>Weight:</td> <td><?php echo$Weight?> lbs</td> </tr> <tr> <td>Type:</td> <td><?php echo $Type?></td> <td>Rank:</td> <td><?php echo $Rank ?></td> </tr> <tr> <td>Age:</td> <td><?php echo $Age ?></td> </tr> <tr> <td>Concept:</td> <td colspan = "3"><?php echo $Concept?></td> </tr> <tr> <td>Signature:</td> <td colspan = "3"><?php echo $Signature?></td> </tr> <tr> <td>Strength:</td> <td><?php echo $STR ?></td> <td>Charisma:</td> <td><?php echo$CHA?></td> <td>Perceptiom:</td> <td><?php echo$PER?></td> </tr> <tr> <td>Dexterity:</td> <td><?php echo$DEX?></td> <td>Manipulation:</td> <td><?php echo$MAN?></td> <td>Intelligence:</td> <td><?php echo$INT?></td> </tr> <tr> <td>Stamina:</td> <td><?php echo$STA?></td> <td>Appearance:</td> <td><?php echo$APP?></td> <td>Wits:</td> <td><?php echo $WIT?></td> </tr> </table> </tr> <tr> <table border="1"> <tr> <td>Alertness:</td> <td width=20%><?php echo $Alert?></td> <td>Blind Fighting:</td> <td><?php echo $Blind?></td> <td>Academics:</td> <td><?php echo $Academics?></td> </tr> </tr> </table> <br> <br> </body> </html> ---- code ---- The page source when viewed shows me: ---- page source ---- <html> <head> <title>Fighter Details</title> </head> <body> <br> <a href="/Fighters/index.php">Home!</a> <a href="createFighter.php">Create Fighter!</a> <br><br> <h4></h4> <br><br> <form method="post" action="viewFighter.php"> Choose a Fighter! <select name='fighter'> <option value="Blake">Blake</option> <option value="Bone Breaker">Bone Breaker</option> <option value="Destroyer">Destroyer</option> <option value="Dominator">Dominator</option> <option value="Hank">Hank</option> <input type="submit" value="Choose!"> </select> </form> <br> <table border="1"> <tr> <table border="1"> <tr> <td>Nick Name:</td> <td width=20%></td> <td>Technique:</td> <td></td> <td rowspan="7" colspan="3" width=25%><img src="/Fighters/chars/.jpg" height="200"/></td> </tr> <tr> <td>Real Name:</td> <td></td> <td idth=20%>Gender:</td> <td></td> </tr> <tr> <td>Height:</td> <td> ft</td> <td>Weight:</td> <td> lbs</td> </tr> <tr> <td>Type:</td> <td></td> <td>Rank:</td> <td></td> </tr> <tr> <td>Age:</td> <td></td> </tr> <tr> <td>Concept:</td> <td colspan = "3"></td> </tr> <tr> <td>Signature:</td> <td colspan = "3"></td> </tr> <tr> <td>Strength:</td> <td></td> <td>Charisma:</td> <td></td> <td>Perceptiom:</td> <td></td> </tr> <tr> <td>Dexterity:</td> <td></td> <td>Manipulation:</td> <td></td> <td>Intelligence:</td> <td></td> </tr> <tr> <td>Stamina:</td> <td></td> <td>Appearance:</td> <td></td> <td>Wits:</td> <td></td> </tr> </table> </tr> <tr> <table border="1"> <tr> <td>Alertness:</td> <td width=20%></td> <td>Blind Fighting:</td> <td></td> <td>Academics:</td> <td></td> </tr> </tr> </table> <br> <br> </body> </html> ---- page source ---- Again, thank you for any help you can give.
×
×
  • 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.