Minecrafter Alex Minecrafter Alex - 23 days ago 11
PHP Question

Whats the php url query for this form?

I have a form that looks like this:

http://saguna.ro/web7/peclase.php

And code is:

<form action="peclase.php" method="post">
<select name="clasa">
<option value="05">V
<option value="06">VI
<option value="07">VII
<option value="08">VIII
<option value="09a">IX A
<option value="09b">IX B
<option value="09c">IX C
</select>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Afiseaza orarul">
</td>
</tr>
</form>


I want to make a website url query to show DIRECTLY the tables for my class

I want to seach in url something like this:http://saguna.ro/web7/peclase.php?clasa=05

And if I enter this it should show the tabel but my query is wrong. I think it should contain
&submit=something
.

Please help me make this query and sorry for my bad English

Answer

You need to use GET instead of POST method as shown below:

<form action="peclase.php" method="get">
    <select name="clasa">
        <option value="05">V
        <option value="06">VI
        <option value="07">VII
        <option value="08">VIII
        <option value="09a">IX A
        <option value="09b">IX B
        <option value="09c">IX C 
    </select>
    <tr>
        <td colspan="2" align="center"> 
            <input type="submit" value="Afiseaza orarul">
        </td>
    </tr>
</form>

Though the question is unclear, assuming by the tag PHP, I presume you have trouble with PHP part. So if your problem is to get the value of clasa to PHP, then:

<?php
if(isset($_GET["clasa"])){
    $clasa=$_GET["clasa"];
    //Perform your query here
}
else
{
    //Form not submitted. Show msg or perform action if required.
}
?>
Comments