473,406 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

help with echoing out the url

hi this should work but i do not know why its not working


Expand|Select|Wrap|Line Numbers
  1.  
  2. $url = $_GET['url'];
  3. echo $url;
  4.  
  5.  
Mar 12 '12 #1

✓ answered by Rabbit

Looks like the errors stem from line 3 and cascade downwards. It's saying that the url variable isn't being passed in GET. Look at the form that is submitted and make sure there's a form control with the name url.

3 1920
Rabbit
12,516 Expert Mod 8TB
What do you mean by not working? Are there error messages? If so, what are they? Is it not printing out the value that was passed? If so, what value was passed and what did it print instead?
Mar 12 '12 #2
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $url = $_GET["url"];
  4. echo $url;
  5.  
  6.  
  7. require 'controllers/' .$url;
  8.  
  9. $controller = new $url;
  10.  
  11.  
  12.  
  13. ?>
  14.  
  15.  
Expand|Select|Wrap|Line Numbers
  1.  
  2. <?php
  3. class Index {
  4.  
  5.     function __construct() {
  6.  
  7.         echo 'we are in index'; 
  8.     }
  9. }
  10.  
  11. ?>
  12.  
  13.  
error:

( ! ) Notice: Undefined index: url in C:\wamp\www\mvc\index.php on line 3
Call Stack
# Time Memory Function Location
1 0.0008 364448 {main}( ) ..\index.php:0

( ! ) Warning: require(C:\wamp\www\mvc\controllers) [function.require]: failed to open stream: Permission denied in C:\wamp\www\mvc\index.php on line 7
Call Stack
# Time Memory Function Location
1 0.0008 364448 {main}( ) ..\index.php:0

( ! ) Fatal error: require() [function.require]: Failed opening required 'controllers/' (include_path='.;C:\php\pear') in C:\wamp\www\mvc\index.php on line 7
Call Stack
# Time Memory Function Location
1 0.0008 364448 {main}( ) ..\index.php:0
Mar 13 '12 #3
Rabbit
12,516 Expert Mod 8TB
Looks like the errors stem from line 3 and cascade downwards. It's saying that the url variable isn't being passed in GET. Look at the form that is submitted and make sure there's a form control with the name url.
Mar 13 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Sugapablo | last post by:
I have the following data in a MySQL database: <a href="<?php echo $server; ?>Sugapablo-Stick_It_To_The_Man.mp3" let's call it $row. when I echo $row, the php code is shown as opposed to the...
11
by: Matthew Robinson | last post by:
the page below returns just the search box everytime. ive not attempted to code the text search yet, but i want it to beable to filter out the category's, but its just not showing any. any idea's...
10
by: Sims | last post by:
Hi I have a table with something like ID PARENT 0 | -1 1 | -1 2 | 1 3 | 1
2
by: TheKeith | last post by:
I'm just learning php and set up a sample mysql db to practice with. I have the following script and cannot for the life of me figure out why it is printing each field of the row twice? I checked...
5
by: Jon | last post by:
All, I'm building a CMS, and have run into another problem that I'm not sure which direction to take on it. Basically, I allow users to add pages, and allow them to hide/unhide links...
11
by: Jim S. | last post by:
hi guys and gals, i have an array, but i have the hardest time putting the value in the table, so what is the normal procedure? thanks Jim
2
by: jayparaiso | last post by:
form action="index.php#order" method="post" name="image1" id="image1"> <input name="image1" type="submit" id="image1" value="Buy!"> form action="index.php#order" method="post" name="image2"...
3
by: vorange | last post by:
Hello, I have a problem I have been unable to solve for quite some time now. I'm using the Serialport class and opening the port and writing a byte to it. The byte is successfully received by...
3
by: Nasif | last post by:
HELLO ALL I am new in serial port programming. I am currently doing a program that communicates to DSP board through COM1 port. But I am using Microsoft Visual Studio 2005. The language that I...
1
by: nbaztec | last post by:
I have made a program to take password from the user and chek if its right or not. There's no problem with it. The only problem i face is to mask the input I know of getpass() but it limits the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.