• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

AAC Stuck at creating an select menu

Joriku

Working in the mines, need something?
Joined
Jul 16, 2016
Messages
1,095
Solutions
15
Reaction score
383
Location
Sweden
YouTube
Joriku
Stuck on creating an selection menu.. It doesn't open the new link, instead it takes downloads.php/?.NETCORE as example
Ideas?

Lua:
<form target="_blank">
 <label for="client"></label>
<select id="client">
  <optgroup label="Select Download:">
 <option href="https://hoxera.com/Hoxera.zip">Auto-Updater</option>
 <option href="https://hoxera.com/.NETCORE.zip">.NETCORE</option>
 <option <a href="https://tibiamaps.io/downloads" target="_blank" type="application/octet-stream" target="_top"> Minimap</a></option>
</select>
<br><br>
<input type="submit" value="Submit">
</form>
 
Solution
What are you trying to do?

A link tag is written like this:
HTML:
<a href="URL_ADDRESS">url text</a>

Want to make it as a dropdown? You cant without processing it in backend or intervene in javascript. (or hack around in CSS)

PHP:
<?php
$download_links = array(
  "updater" => "https://hoxera.com/Hoxera.zip",
  "netcore" => "https://hoxera.com/.NETCORE.zip",
  "map" => "https://tibiamaps.io/downloads"
);

$download_url = false;
if (isset($_GET['client']) && isset($download_links[$_GET['client']])) {
  $download_url = $download_links[$_GET['client']];
  header("Location: {$download_url}");
  die();
}
?>

<form action="" method="GET" target="_blank">
  <label for="client"></label>
  <select id="client" name="client">
    <optgroup...
What are you trying to do?

A link tag is written like this:
HTML:
<a href="URL_ADDRESS">url text</a>

Want to make it as a dropdown? You cant without processing it in backend or intervene in javascript. (or hack around in CSS)

PHP:
<?php
$download_links = array(
  "updater" => "https://hoxera.com/Hoxera.zip",
  "netcore" => "https://hoxera.com/.NETCORE.zip",
  "map" => "https://tibiamaps.io/downloads"
);

$download_url = false;
if (isset($_GET['client']) && isset($download_links[$_GET['client']])) {
  $download_url = $download_links[$_GET['client']];
  header("Location: {$download_url}");
  die();
}
?>

<form action="" method="GET" target="_blank">
  <label for="client"></label>
  <select id="client" name="client">
    <optgroup label="Select Download:">
    <option value="updater">Auto-Updater</option>
    <option value="netcore">.NETCORE</option>
    <option value="map"> Minimap</a></option>
  </select>
  <br><br>
  <input type="submit" value="Submit">
</form>
 
Solution
What are you trying to do?

A link tag is written like this:
HTML:
<a href="URL_ADDRESS">url text</a>

Want to make it as a dropdown? You cant without processing it in backend of intervene in javascript. (or hack around in CSS)

PHP:
<?php
$download_links = array(
  "updater" => "https://hoxera.com/Hoxera.zip",
  "netcore" => "https://hoxera.com/.NETCORE.zip",
  "map" => "https://tibiamaps.io/downloads"
);

$download_url = false;
if (isset($_GET['client']) && isset($download_links[$_GET['client']])) {
  $download_url = $download_links[$_GET['client']];
  header("Location: {$download_url}");
  die();
}
?>

<form action="" method="GET" target="_blank">
  <label for="client"></label>
  <select id="client" name="client">
    <optgroup label="Select Download:">
    <option value="updater">Auto-Updater</option>
    <option value="netcore">.NETCORE</option>
    <option value="map"> Minimap</a></option>
  </select>
  <br><br>
  <input type="submit" value="Submit">
</form>
Wow, did not realize that you'd need to use a js for that.
Just needed to be able to open the new link in a new tab and it would just auto download it. Thank you, solved the issue.
 
Wow, did not realize that you'd need to use a js for that.
Just needed to be able to open the new link in a new tab and it would just auto download it. Thank you, solved the issue.
FYI, he's using PHP not JS, which is a pre-processor for HTML, a server side language. On submit, PHP uses the GET method to read variables in the URL, and changes location depending on its value, before anything is sent to the user.

You don't necessarily need to use it. You could also use a javascript listener for the onchange event to change URL.

Either way is fine.
 
Alright, instead of creating a new thread, stuck once more.
Can't understand why it's being stretched..
4dda1b984b5f188ba3c4a9b7dd4bbec7.png


Lua:
<center>
            <form action="downloads.php" method="post" style="padding:0px;margin:0px;">
                <div class="cover" style="background-image:url(images/buttons/sbutton.gif)" >
                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" >
                        <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url(images/buttons/sbutton_over.gif);" ></div>
                        <input class="ButtonText" type="image" name="I agree" alt="I agree" src="images/buttons/_sbutton_iagree.gif" >
                    </div>
                </div>
            </form>
        </center>
        </div>
 
Without seeing the css, I'm guessing .cover has either 100% width or a fixed width larger than the image size. Try this:
HTML:
<center>
            <form action="downloads.php" method="post" style="padding:0px;margin:0px;">
                <div class="cover" style="background-image:url(images/buttons/sbutton.gif);background-repeat:no-repeat;" >
                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" >
                        <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url(images/buttons/sbutton_over.gif);background-repeat:no-repeat;" ></div>
                        <input class="ButtonText" type="image" name="I agree" alt="I agree" src="images/buttons/_sbutton_iagree.gif" >
                    </div>
                </div>
            </form>
        </center>
        </div>

But really, you should have a fixed width for the button, and/or float left.

If the issue still exists, post the CSS for .cover and .BigButtonOver too
 
Without seeing the css, I'm guessing .cover has either 100% width or a fixed width larger than the image size. Try this:
HTML:
<center>
            <form action="downloads.php" method="post" style="padding:0px;margin:0px;">
                <div class="cover" style="background-image:url(images/buttons/sbutton.gif);background-repeat:no-repeat;" >
                    <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" >
                        <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url(images/buttons/sbutton_over.gif);background-repeat:no-repeat;" ></div>
                        <input class="ButtonText" type="image" name="I agree" alt="I agree" src="images/buttons/_sbutton_iagree.gif" >
                    </div>
                </div>
            </form>
        </center>
        </div>

But really, you should have a fixed width for the button, and/or float left.

If the issue still exists, post the CSS for .cover and .BigButtonOver too
Lands all the way over here:
a804e3f6ee65a129492988523a80deaa.png


My css:
At the bottom I have:
Lua:
.BigButton.btn
{
    text-align: center;
    line-height: 25px;
    color: #eed1a3;
    text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, -1px 1px 0 #000, 1px -1px 0 #000, 0px 1px 0 #000, 1px 0px 0 #000, -1px 0px 0 #000, -1px 0px 0 #000;
    transition: opacity 0.1s linear;vertical-align: middle; 
}
input[type="submit"].BigButton.btn 
{
    background:url(images/buttons/sbutton.gif);
    border: 0 none;
    width: 135px;
    height: 25px;
    text-align: center;
    line-height: 25px;
    padding: 0;
    margin: 0;
    color: #eed1a3;
    text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, -1px 1px 0 #000, 1px -1px 0 #000, 0px 1px 0 #000, 1px 0px 0 #000, -1px 0px 0 #000, -1px 0px 0 #000;
    transition: opacity 0.1s linear;
}
.BigButton.btn:hover, input[type="submit"].BigButton.btn:hover
{
    opacity: 0.9;
    color: orange;
    cursor: pointer;
}
 
Back
Top Bottom