473,387 Members | 1,575 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,387 software developers and data experts.

How to make URL Like index.php?dir=this&page=that

2
Well i am not too good in php.. i am having problem while creating url like index.php?dir=this&page=that , i am trying to develop it without any MYSQL Database.. can anyone guide me that how to create such URL's..

Regards

HAMZA
Jun 15 '08 #1
3 1704
Atli
5,058 Expert 4TB
Hi.

That's the kind of URL you get when submitting a <form> using the GET method.

The values are simply encoded into the string and can then be fetched through the $_GET superglobal.

You don't have to use the <form> element tho. You can do something like this, for example:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if(isset($_GET['myvar'])) {
  3.   echo "<p>". $_GET['myvar'] ."</p>";
  4. }
  5. echo '<a href="thispage.php?myvar='. time() .'">Linkage</a>';
  6. ?>
  7.  
Which should print the timestamp when the link was clicked at the top of the page.
Jun 15 '08 #2
Ahmar
2
Dear... i am not asking for form request.. i am just asking about to call pages in index.php Page from different directories and subdirectories i hope u got my question now...
Jun 16 '08 #3
dlite922
1,584 Expert 1GB
Dear... i am not asking for form request.. i am just asking about to call pages in index.php Page from different directories and subdirectories i hope u got my question now...
For example if i wanted to go to this URL:

http://www.domainxyz.com/index.php?dir=/path/to/file/&file=myPage.php

You can re-direct to that page by using header(), but In your case I think you want to just display that page. In that case

[PHP]

<?php

$fileToOpen = $_GET['dir'] . $_GET['file']

if(file_exists($fileToOpen))
{
include($fileToOpen);
}
else
{
print("Sorry, This page does not exist");
}

?>


[/PHP]

Hope that helps. Good luck,

Dan
Jun 16 '08 #4

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

Similar topics

1
by: Horace | last post by:
Hello Does anyone know how to remove (or make more general) both the Imports clause (in a class .vb file) and the Page directive (specifically the Inherits clause in a web page .aspx file). ...
5
by: Neil Rossi | last post by:
I have an issue with a particular ASP page on two web servers. Let's call these servers Dev1 and Beta1. Both Servers are running IIS 5, Windows 2000 SP4 with "almost" all of the latest patches. ...
5
by: murrayatuptowngallery | last post by:
I'm caught in a classic finger-pointing situation. My hosting company's server appears to be automatically inserting JS tags into a JS-free html page that has an image inked to a 2nd page with...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
26
by: Robert Baer | last post by:
The following passes the test as valid, and the mouseover for the six indicated areas also work. I need various areas to link to another page, including the six mentioned. However either the MAP...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
3
by: Blasting Cap | last post by:
I'm using VS 2005, SQL 2005 reporting services. SQL reporting services is working, and I have it both on my local computer, as well as on a server. I've created a report in the SQL Business...
3
by: hsahealthsavings | last post by:
I made this page using a free html editor called formbreeze. The issue is 1) There is a whole bunch of white space at the end of the page that I cannot seem to figure how to get rid of 2) I have...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...

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.