Jump to content

Drop down menu form help... :(


fellixombc

Recommended Posts

Alright, so I have a form and this is what i got so far:

 

<form action="statSig.php" method="post">
RS2 Username: <input type="text" class="box_sub" name="name" />
<select>
  <option>Black</option>
  <option>Green</option>
  <option>Steel</option>
</select>

<input type="submit" class="submit_price" />
<label>
</label>
</form>

 

 

 

The whole document

<?php
include("which.php");
$getname = $_GET['name'];
if($getname) {
header('Content-type: image/png');
$file = @file('http://hiscore.runescape.com/index_lite.ws?player=' . $getname);
$levels = array(); 
$experience = array(); 
$ranks = array(); 
if($file){ 
                foreach($file as $id => $stat){ 
                    $skill = explode(',',trim($stat)); 
                    array_push($ranks, str_replace("-1", "--", $skill[0])); 
                    array_push($levels, str_replace("-1", "--", $skill[1])); 
                    if($id < 25){ 
                        array_push($experience, str_replace("-1", "--", $skill[2])); 
                    } 
                } 
    }
        $attack = $levels[1];
        $defence = $levels[2];
        $strength = $levels[3];
        $hp = $levels[4];
        $prayer = $levels[5];
        $ranged = $levels[6];
        $magic = $levels[7];
$summoning = $levels[24];
        $combatLevel = ceil($defence + $hp + $summoning + floor($prayer / 2)) * 0.25 + 1; 
        $melee = ($attack + $strength) * 0.259;
        $ranger = floor($ranged * 1.5) * 0.245;
        $mage = floor($magic * 1.5) * 0.245; 
$ranger = ceil($ranger);
$mage = ceil($mage);
$melee = ceil($melee);
        if ($melee >= $ranger && $melee >= $mage) {
            $combat = ceil($combatLevel + $melee);
        } else if ($ranger >= $melee && $ranger >= $mage) {
            $combat = ceil($combatLevel + $ranger);
        } else if ($mage >= $melee && $mage >= $ranger) {
            $combat = ceil($combatLevel + $mage);
        }


$getname = str_replace("_", " ", ucfirst(strtolower($getname)));
$imres = imagecreatefrompng("./images/sigs/" . $im);
$black = imagecolorallocate($imres, 0, 0, 0);
$grey = imagecolorallocate($imres, 62, 62, 62);
imagettftext($imres, 16, 0, 260, 22, $black, "arial.ttf", $getname);
imagettftext($imres, 16, 0, 262, 22, $grey, "arial.ttf", $getname);
imagettftext($imres, 11, 0, 278, 48, $black, "arial.ttf", $levels[0]);
imagettftext($imres, 11, 0, 278, 73, $black, "arial.ttf", $combat);
imagettftext($imres, 10, 0, 40, 17, $black, "arial.ttf", $levels[1]);
imagettftext($imres, 10, 0, 40, 40, $black, "arial.ttf", $levels[2]);
imagettftext($imres, 10, 0, 40, 63, $black, "arial.ttf", $levels[3]);
imagettftext($imres, 10, 0, 40, 86, $black, "arial.ttf", $levels[4]);
imagettftext($imres, 10, 0, 40, 109, $black, "arial.ttf", $levels[5]);
imagettftext($imres, 10, 0, 40, 132, $black, "arial.ttf", $levels[6]);
imagettftext($imres, 10, 0, 103, 17, $black, "arial.ttf", $levels[7]);
imagettftext($imres, 10, 0, 103, 40, $black, "arial.ttf", $levels[8]);
imagettftext($imres, 10, 0, 103, 63, $black, "arial.ttf", $levels[9]);
imagettftext($imres, 10, 0, 103, 86, $black, "arial.ttf", $levels[10]);
imagettftext($imres, 10, 0, 103, 109, $black, "arial.ttf", $levels[11]);
imagettftext($imres, 10, 0, 103, 132, $black, "arial.ttf", $levels[12]);
imagettftext($imres, 10, 0, 166, 17, $black, "arial.ttf", $levels[13]);
imagettftext($imres, 10, 0, 166, 40, $black, "arial.ttf", $levels[14]);
imagettftext($imres, 10, 0, 166, 63, $black, "arial.ttf", $levels[15]);
imagettftext($imres, 10, 0, 166, 86, $black, "arial.ttf", $levels[16]);
imagettftext($imres, 10, 0, 166, 109, $black, "arial.ttf", $levels[17]);
imagettftext($imres, 10, 0, 166, 132, $black, "arial.ttf", $levels[18]);
imagettftext($imres, 10, 0, 229, 17, $black, "arial.ttf", $levels[19]);
imagettftext($imres, 10, 0, 229, 40, $black, "arial.ttf", $levels[20]);
imagettftext($imres, 10, 0, 229, 63, $black, "arial.ttf", $levels[21]);
imagettftext($imres, 10, 0, 229, 86, $black, "arial.ttf", $levels[22]);
imagettftext($imres, 10, 0, 229, 109, $black, "arial.ttf", $levels[23]);
imagettftext($imres, 10, 0, 229, 132, $black, "arial.ttf", $levels[24]);
imagepng($imres);
imagedestroy($imres);
} 
?>
<?php include("top.php"); ?>
  <?php include("banner_s.php"); ?>
  <?php include("nav1.php"); ?>
  </div>
  <div class="content"><font face="Arial, Helvetica, sans-serif">
<?php 
if(isset($_POST['name'])) {
echo "<img src=\"statSig.php?name=" . $_POST['name'] . "\" /><br />";
echo "Forum Link:<br />";
echo "[img]http://rstools.ws/statSig.php?name=" . $_POST['name'];
echo "[/img]";
} else {
?>
<form action="statSig.php" method="post">
RS2 Username: <input type="text" class="box_sub" name="name" />
<select>
  <option>Black</option>
  <option>Green</option>
  <option>Steel</option>
</select>

<input type="submit" class="submit_price" />
<label>
</label>
</form>
</font>
<?php
}
?>
</div>
    <?php include("nav2.php"); ?>
<?php include("copyright.php"); ?>

 

How do i make it so, when they select "black" and click submit, it won't be http://rstools.ws/statSig.php?name=lite22 but like

http://rstools.ws/statSig.php?name=lite22?=green

 

 

what code would do this?

Link to comment
Share on other sites

Well this is more HTML question than PHP. You aren't setting your values in your option attributes.

 

 

<select>
  <option value="black">Black</option>
  <option value="green">Green</option>
  <option value="steel">Steel</option>
</select>

 

And your  using POST method, that's wrong if you want your selection to go up in your URL.

You will have to use GET method.

 

 

Link to comment
Share on other sites

not html at all. I know how to make a form, I'm asking if they select black, it would show the rs stat sig bg as:

http://rstools.ws/images/sigs/black-range.png

 

and the url would be

 

http://rstools.ws/statSig.php?theme=1?name=goku_the_mon

 

but if they select green, it would show the green image, http://rstools.ws/images/sigs/green-melee.png,

it would show

http://rstools.ws/statSig.php?theme=2?name=goku_the_mon

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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