Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There are several issues here.</p> <p>Try not to use ternaries if you can get away with it. They're just hard to read, and can be confusing. This is of course my own opinion. Also, I check with strlen() instead of isset, as I have had issues with isset() and arrays.</p> <pre><code>&lt;?php if (strlen($_GET["name"]) &gt; 0) { $urlname = $_GET['name']; echo "GET: $urlname"; } elseif (strlen($_POST["name"]) &gt; 0) { $urlname = $_POST['name']; echo "POST: $urlname"; } else { $urlname = 'ddd'; echo "NONE: $urlname"; } ?&gt; </code></pre> <p>You don't need the parentheses around a string declaration.</p> <pre><code>&lt;?php $url = "http://localhost/web12/directory/list=".$urlname; echo $url; ?&gt; </code></pre> <p>Forms get or post data only by submitting information, where anchor (a) tags send information through get (the query string after the filename). So you're mixing these without getting the effect you want.</p> <p><strong>GET</strong></p> <p>Will send information through the query string (like a link):</p> <pre><code>&lt;form action="t.php" method="get" target="_self"&gt; &lt;input type="radio" name="name" value="aaa"/&gt; AAA&lt;br/&gt; &lt;input type="radio" name="name" value="bbb"/&gt; BBB&lt;br/&gt; &lt;input type="radio" name="name" value="ccc"/&gt; CCC &lt;input type="submit"/&gt; &lt;/form&gt; </code></pre> <p>Note the submit button.</p> <p><strong>POST</strong></p> <p>Will submit as post information, without affecting the action url:</p> <pre><code>&lt;form action="t.php" method="post" target="_self"&gt; &lt;input type="radio" name="name" value="aaa"/&gt; AAA&lt;br/&gt; &lt;input type="radio" name="name" value="bbb"/&gt; BBB&lt;br/&gt; &lt;input type="radio" name="name" value="ccc"/&gt; CCC &lt;input type="submit"/&gt; &lt;/form&gt; </code></pre> <p>Note the submit button.</p> <p><strong>ANCHOR GET</strong></p> <p>Links do not fire the form submit, no matter if they are within a form element or outside of one. They're just not part of the form submit process.</p> <pre><code>&lt;a href="t.php?name=aaa"&gt;aaa&lt;/a&gt; &lt;a href="t.php?name=bbb"&gt;bbb&lt;/a&gt; &lt;a href="t.php?name=ccc"&gt;ccc&lt;/a&gt; </code></pre>
 

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