help
-
- Posts: 5
- Joined: Sat Nov 02, 2013 5:56 pm
help
hy!
I need help with this.
<?php
include_once 'connect.php';
session_start();
include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
include_once 'statpanel.php';
$playerid = $playerinfo3['id'];
?>
</div>
<div id="table">
<?php
$counter = 0;
echo "<small>";
print "<center>";
print "<table border='0' width='70%' cellspacing='20'>";
print "<tr><td width='25%' valign='top'>";
print "</td>";
print "<td valign='top' width='75%'>";
$invinfo="SELECT * from playermagic where pid='$playerid'";
$invinfo2=mysql_query($invinfo) or die("could not select player magic");
print "<table border='1' bordercolor='white' bgcolor='#ffffff'>";
print "<tr><td>Name<font color='ffffff'>________________</font></td><td>Level<font color='ffffff'>______</td><td>Type<font color='ffffff'>______</td><td>Value<font color='ffffff'>______</td><td>Point Cost<font color='ffffff'>______</td><td><font color='ffffff'>________________</td></tr>";
while($invinfo3=mysql_fetch_array($invinfo2))
{
print "<tr><td>$invinfo3[name]</td><td>$invinfo3[level]</td><td>$invinfo3[type]</td><td>$invinfo3[svalue]</td><td>$invinfo3[scost]</td><td><A href='attack.php?sid=$invinfo3[sid]'>Use Magic</td></tr>";
$counter = 1;
}
print "</table>";
print "</td></tr></table>";
print "</center>";
echo "</small>";
if ($counter == 0)
{
echo "<center>You have no Spells!<br>";
echo "<a href='battle.php>Go Back</center>";
exit;
}
echo "<center><a href='battle.php>NeverMind</center>";
?>
</div>
thia is halls usemagic code. I wanna do a option menu like he did in the register.php where u choose the class instead of this but my html knowledge is bellow 0. But I don't whant a select button. the moment a spell is chosen I whant to use that spell directly,since I will add more spell classes each with a different menu.
tanks in advance and I sincerilly do apologise for my bad English but I stuffer a massive hangover from last night
I need help with this.
<?php
include_once 'connect.php';
session_start();
include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
include_once 'statpanel.php';
$playerid = $playerinfo3['id'];
?>
</div>
<div id="table">
<?php
$counter = 0;
echo "<small>";
print "<center>";
print "<table border='0' width='70%' cellspacing='20'>";
print "<tr><td width='25%' valign='top'>";
print "</td>";
print "<td valign='top' width='75%'>";
$invinfo="SELECT * from playermagic where pid='$playerid'";
$invinfo2=mysql_query($invinfo) or die("could not select player magic");
print "<table border='1' bordercolor='white' bgcolor='#ffffff'>";
print "<tr><td>Name<font color='ffffff'>________________</font></td><td>Level<font color='ffffff'>______</td><td>Type<font color='ffffff'>______</td><td>Value<font color='ffffff'>______</td><td>Point Cost<font color='ffffff'>______</td><td><font color='ffffff'>________________</td></tr>";
while($invinfo3=mysql_fetch_array($invinfo2))
{
print "<tr><td>$invinfo3[name]</td><td>$invinfo3[level]</td><td>$invinfo3[type]</td><td>$invinfo3[svalue]</td><td>$invinfo3[scost]</td><td><A href='attack.php?sid=$invinfo3[sid]'>Use Magic</td></tr>";
$counter = 1;
}
print "</table>";
print "</td></tr></table>";
print "</center>";
echo "</small>";
if ($counter == 0)
{
echo "<center>You have no Spells!<br>";
echo "<a href='battle.php>Go Back</center>";
exit;
}
echo "<center><a href='battle.php>NeverMind</center>";
?>
</div>
thia is halls usemagic code. I wanna do a option menu like he did in the register.php where u choose the class instead of this but my html knowledge is bellow 0. But I don't whant a select button. the moment a spell is chosen I whant to use that spell directly,since I will add more spell classes each with a different menu.
tanks in advance and I sincerilly do apologise for my bad English but I stuffer a massive hangover from last night
Re: help
Hello!
You might want to wrap your code inside [ CODE] and [ /CODE] to make it more easier for others to read.
Also you might want to say that what problem you have with your code.
But I guess your issue is here:
To pinpoint this more closely:
You are starting a <a>-tag but never ending it, so your Use Magic-link is quite a big one!
So try adding a closer-tag after the text, 'Use Magic'
like this,
You might want to wrap your code inside [ CODE] and [ /CODE] to make it more easier for others to read.
Also you might want to say that what problem you have with your code.
But I guess your issue is here:
Code: Select all
print "<tr><td>$invinfo3[name]</td><td>$invinfo3[level]</td><td>$invinfo3[type]</td><td>$invinfo3[svalue]</td><td>$invinfo3[scost]</td><td><A href='attack.php?sid=$invinfo3[sid]'>Use Magic</td></tr>";
Code: Select all
<A href='attack.php?sid=$invinfo3[sid]'>Use Magic</td>
So try adding a closer-tag after the text, 'Use Magic'
like this,
Code: Select all
<A href='attack.php?sid=$invinfo3[sid]'>Use Magic</a></td>
Why so serious?
Business Intelligence, Data Engineering, Data Mining
PHP, HTML, JavaScript, Bash/KornShell, Python, C#, PL/SQL
MySQL, DB2, Oracle, Snowflake
Pentaho, DataStage, Matillion, Unity3D, Blender
Business Intelligence, Data Engineering, Data Mining
PHP, HTML, JavaScript, Bash/KornShell, Python, C#, PL/SQL
MySQL, DB2, Oracle, Snowflake
Pentaho, DataStage, Matillion, Unity3D, Blender
- hallsofvallhalla
- Site Admin
- Posts: 12023
- Joined: Wed Apr 22, 2009 11:29 pm
Re: help
Yep make sure to not label your title as "help". Most people won't even bother looking. If everyone did that it would be a forum full of help posts and no one would no where to go
Also what error are you getting?
Also what error are you getting?
-
- Posts: 5
- Joined: Sat Nov 02, 2013 5:56 pm
Re: help
there is no problem with the code. it works perfectlly.
Its just that i dont whant the available spells to be listed in a table. insted i whant a option menu similar to the one u did for the register.php where u select the class u whant o have
Its just that i dont whant the available spells to be listed in a table. insted i whant a option menu similar to the one u did for the register.php where u select the class u whant o have
Re: help
Code: Select all
echo "<center>You have no Spells!<br>";
Code: Select all
echo "<a href='battle.php>Go Back</center>";
Code: Select all
echo "<center><a href='battle.php>NeverMind</center>";
Also might want to close those <a href>'s off with a </a> as well.
Re: help
You can do something like this:
Not tested, but should be close!
Code: Select all
<form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
<label for='spells[]'>Select the spells that you wish to use:</label><br>
<select multiple="spells" name="spells[]">
<option value="Spell">Spell</option>
<option value="Spell">Spell</option>
<option value="Spell">Spell</option>
<option value="Spell">Spell</option>
</select><br>
<input type="submit" name="formSubmit" value="Submit" >
</form>
Re: help
or just a simple dropdown:
You should be able to look over the class code that Halls has, and just change a bit of info in order for it to do spells?
Code: Select all
<label for="spells">Spells</label><br />
<select name="spell" id="spell">
<option value="spell">spell1</option>
<option value="spell">spell2</option>
<option value="spell">spell3</option>
<option value="spell">spell4 </option>
</select>
Re: help
Or if u're wanting to get spells from the database...
Again, not tested, but should give you an idea.
Code: Select all
Select Spell:
<form method="post" action="spell.php">
<label for="select"><select name="spell" value="Select" size="10">
<?php
$sql = "SELECT * FROM spells";
$result = mysql_query($sql) or die (mysql_error());
while ($row = mysql_fetch_array($result))
{
$id=$row["id"];
$name=$row["spell_name"];
$options.="<OPTION VALUE=\"$id\">".$name;
}
?>
<option>
<? echo $options ?>
</option>
</select>
<input type="submit" name="Submit" value="Submit">
</form>
-
- Posts: 5
- Joined: Sat Nov 02, 2013 5:56 pm
Re: help
<form method="post" action="spell.php">
i dont have a spell.php
i am trying to create a game like halls was doing in his tutorial, but i need help with many things. can i post the url of my site or it will count as a free advertisment?
i dont have a spell.php
i am trying to create a game like halls was doing in his tutorial, but i need help with many things. can i post the url of my site or it will count as a free advertisment?
Re: help
You might want to follow the tutorial and figure it out that way, helping someone from scratch is kind of difficult.
Why so serious?
Business Intelligence, Data Engineering, Data Mining
PHP, HTML, JavaScript, Bash/KornShell, Python, C#, PL/SQL
MySQL, DB2, Oracle, Snowflake
Pentaho, DataStage, Matillion, Unity3D, Blender
Business Intelligence, Data Engineering, Data Mining
PHP, HTML, JavaScript, Bash/KornShell, Python, C#, PL/SQL
MySQL, DB2, Oracle, Snowflake
Pentaho, DataStage, Matillion, Unity3D, Blender