Note that there are some explanatory texts on larger screens.

plurals
  1. POEmpty $_GET array despite defining variable
    primarykey
    data
    text
    <p>I'm learning php so bare with me please. I was just throwing together the beginnings of a website on my localhost server -- Apache, MYSQL, MYPHPADMIN. All appeared to be working fine until I attempted to link up the navigation dynamically using $_GET. Here is the code in index.php: </p> <pre><code>&lt;?php include('Config/setup.php') ?&gt; &lt;?php if ($_GET['page'] == ''){ $pg = 'home'; } else { $pg =$_GET['page']; } ?&gt; &lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt; &lt;title&gt;FTS&lt;/title&gt; &lt;link rel="stylesheet" type="text/css" href="css/Styles.css"/&gt; &lt;/head&gt; &lt;body&gt; &lt;div class ="header temp_Block"&gt; &lt;?php include('templates/header.php');?&gt; &lt;/div&gt; &lt;div class ="main_nav temp_Block"&gt; &lt;?php include('templates/main_nav.php');?&gt; &lt;/div&gt; &lt;div id ="Content"&gt; &lt;div class ="main_content temp_Block "&gt; &lt;?php include ('content/'.$pg.'php'); ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class = "footer temp_Block"&gt; &lt;?php include('templates/footer.php');?&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>When I checked my links to see if I was able to link to my various pages -- home, services, about us etc. Its giving me this error: </p> <pre><code>Notice: Undefined index: page in C:\xampp\htdocs\test\index.php on line 6 Warning: include(content//content/homephp): failed to open stream: No such file or directory in C:\xampp\htdocs\test\index.php on line 35 Warning: include(): Failed opening 'content//content/homephp' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\test\index.php on line 35 </code></pre> <p>So I ran this to see what was going on with $_GET:</p> <pre><code>var_dump($_GET); exit; </code></pre> <p>The array is empty. IT shows nothing. I've used this method before but the difference was I was on a hosted site. I checked to see if I had permissions problems but I checked apache.conf and nothing appeared to be wrong. </p> <p>Any help would be appreciated since I'm really trying to get my head around this stuff. Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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