Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>With your question, there seems like there are two different outcomes you want to achieve; the first being that you want to pass the value of the <code>&lt;select&gt;</code> dropbox to the landing php page, while your example code suggests that you want to pass the <code>&lt;select&gt;</code> value with appending "You have selected :" to it. So basically - with the given information - there are two outcomes you want to achieve, the first being the final "GET" url being</p> <pre><code>http://localhost/timer.php?selectvalue=1 </code></pre> <p>And the other with the "GET" url being</p> <pre><code>http://localhost/timer.php?selectvalue=You%20have%20selected%20:1 </code></pre> <p>With the first outcome, using javascript is a bad way of approaching this, I suggest to you to use the standard html <code>&lt;form&gt;</code> tag to build your form and <code>&lt;input&gt;</code> instead of the <code>&lt;a&gt;</code> tag as a button</p> <pre><code>&lt;form action="timer.php" method="get"&gt; &lt;select id="ccrseid" name="selectvalue" onchange="showMe(this.value);"&gt; &lt;option value=""&gt;Select&lt;/option&gt; &lt;option value="1"&gt;Computer Science&lt;/option&gt; &lt;option value="2"&gt;Engineering&lt;/option&gt; &lt;option value="3"&gt;Business&lt;/option&gt; &lt;option value="4"&gt;Education and Training&lt;/option&gt; &lt;/select&gt; &lt;input type="submit" value="Submit"&gt; &lt;form&gt; </code></pre> <p>With the second solution, that being to print the <code>&lt;select&gt;</code> value into a div and send that data to the landing page with a <code>&lt;a&gt;</code> tag, what you need to do is to to change the link on the last line</p> <pre><code>&lt;a href="#"onclick="document.location.href='timer.php?electvalue='+document.getElementById('myDiv').value"&gt;Submit&lt;/a&gt; </code></pre> <p>to</p> <pre><code>&lt;a href="#"onclick="document.location.href='timer.php?electvalue='+document.getElementById('myDiv').innerHTML"&gt;Submit&lt;/a&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload