PDA

View Full Version : adding icons to users selections.


MrTickles
01-19-2003, 02:11 PM
Hello,

Im tryoing to figure out how to add icons to users when they make a selection from a drop menu in a form.


For example:

on the forum there is a drop menu with 3 options. If they choose option 2, on the page that list their information they entered I would Like an option2 icon to be placed.

Right now I can only get text to show.

I hope this makes sense. I can post any other material that would help out.


Thank you for your time.

mordred
01-19-2003, 02:14 PM
You stay a little bit unclear on where the icon should be displayed and how. Post the source code you have done already, that will give us an idea what you want to achieve and we can better assist.

MrTickles
01-20-2003, 07:14 PM
<?php

include ("include/header2.inc.php");
include ("include/dbconnect.php");

if ($searchstring)
{
$sql="SELECT * FROM $table WHERE $searchtype LIKE '%$searchstring%' ORDER BY name ASC";


$result = mysql_query($sql);
$resultsnumber = mysql_numrows($result);

echo "<TABLE BORDER=1 cellpadding=3 cellspacing=0 align=center>";
echo "number of results: $resultsnumber";

$alternate = "2";
while ($myrow = mysql_fetch_array($result))
{
$name = $myrow["name"];
$id = $myrow["id"];
$recruit = $myrow["recruit"];
$section = $myrow["section"];

if ($alternate == "1") {
$color = "#808000";
$alternate = "2";
}
else {
$color = "#6a6a35";
$alternate = "1";
}
echo "<TR bgcolor=$color><td><font color=lime><b>$section</font></td><TD><font color=black><b>$name</TD>";
echo "<td><a href='view2.php?id=$id'><b>See Details</a></b></td>";
}
echo "</TR>";
?>
<tr><td colspan=3><center>
<A href="http://www.highknightz.com/hk/php/member/az1.php"><b>A-Z</a> &nbsp&nbsp|&nbsp&nbsp
<A href="http://www.highknightz.com/hk/php/member/index.php"><b>Search</a> &nbsp&nbsp|&nbsp&nbsp
<A href="http://www.highknightz.com/hk/php/member/listall.php"><b>View All</a> &nbsp&nbsp|&nbsp&nbsp
<A href="http://www.highknightz.com/hk/php/member/login/"><b>Join</a></td></tr></table>
<?
}


else
{
?>
<form method="POST" action="<? $PHP_SELF ?>">

<table border=1 cellspacing=0 cellpadding=2 width=380 align=center>
<tr>
<td colspan=2><center>Search for Members by the Following:</td>


</tr>
<tr>
<td><input type="radio" name="searchtype" value="recruit"> <b>Recruiter</b><br>
<input type="radio" name="searchtype" value="name" checked> <b>Name</b>

</td><td><input type="text" name="searchstring" size="35"><br><input type="submit"></td></td>
</tr>
</table>
</form>

<form method="POST" action="<? $PHP_SELF ?>">
<table border=1 cellspacing=0 cellpadding=2 width=380 align=center>
<tr>
<td><b>Section</b> <input type="hidden" name="searchtype" value="section">
<select name="searchstring">
<option value="B-Net">Battle.Net</option>
<option value="CS">Counter-Strike</option>
<option value="BF-1942">BattleField 1942</option>
</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td><td><input type="submit"></td>
</tr>
</table>
</form>

<form method="POST" action="<? $PHP_SELF ?>">
<table border=1 cellspacing=0 cellpadding=2 width=380 align=center>
<tr>
<td><b>Rank</b> &nbsp;&nbsp;&nbsp; <input type="hidden" name="searchtype" value="rank">
<select name="searchstring">
<option value="Clan Leader" selected>Clan Leader</option>
<option value="Division Leader">Division Leader</option>
<option value="Division Commander">Division Commander</option>
<option value="Council Member">Council Member</option>
<option value="Recruiter BNET">Recruiter BNET</option>
<option value="Recruiter CS">Recruiter CS</option>
<option value="Recruiter BF1942">Recruiter BF1942</option>
<option value="Member">Member</option>
<option value="Trainee">Trainee</option>
<option value="Pending">Pending</option>
</select></td><td><input type="submit"></td>
</tr>
</table>
</form>

<table border=1 cellspacing=0 cellpadding=2 width=380 align=center>
<tr>
<td><center>
<A href="http://www.highknightz.com/hk/php/member/az1.php"><b>A-Z</a> &nbsp&nbsp|&nbsp&nbsp
<A href="http://www.highknightz.com/hk/php/member/index.php">Search</a>
&nbsp;&nbsp;|&nbsp;&nbsp;
<A href="http://www.highknightz.com/hk/php/member/listall.php">View All</a>
&nbsp;&nbsp;|&nbsp;&nbsp; <A href="http://www.highknightz.com/hk/php/member/login/">Join</a></td>
</tr>
</table>

<?
}

include ("include/footer.inc.php");
?>


This is the search.php page you can see working @
http://highknightz.com/hk/php/member/search.php to get an idea of what im talking about.

I want to replace the part that list the section name (CS, BF1942, BNET) with a icon picture. But i cant figure out how to do that. Sorry wish I had a better grasp on the php lingo to explain it a little better :)


If you need anything else let me know Ill be happy to get tis problem fixed :)

Thank you for your time

mordred
01-20-2003, 08:09 PM
I'll reckon that you have to replace this part


echo "<TR bgcolor=$color><td><font color=lime><b>$section</font></td><TD><font color=black><b>$name</TD>";


with the appropriate HTML for including an image:


echo "<TR bgcolor=$color><td><img src='$section.gif' /></td><TD><font color=black><b>$name</TD>";


Of course you need an image that goes by the name of the retrieved section. And it hasn't got much to do with PHP, this is just HTML editing. So don't hesitate, you can't do much wrong by changing the lines that echo() prints.

MrTickles
01-21-2003, 09:07 PM
Thank you, worked very good.