Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
what is this called? (noob question)
Old 05-07-2010, 08:07 PM what is this called? (noob question)
Junior Talker

Posts: 3
Name: i have no name
Trades: 0
hey, i'm new here and i am wondering how you make a php file like file.php?text&moretext. i'm sorry if you don't get what i'm saying. if you dont, reply and i'll try to explain better.
Thanks for reading.
a124 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-07-2010, 08:37 PM Re: what is this called? (noob question)
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
You can't make a file like that and here is why:

You would create a file called "file.php". The question mark and everything after it are called URL parameters and they're not a part of the filename. Basically, parameters are one or more sets of variables and their values transmitted through the URL to send information to "file.php". You can see an example of this whenever you do a search on Google. The 'q' parameter stands for 'query' and is set equal to your search. So if you search for 'dogs', the URL will be http://google.com/search?q=dogs. In PHP, you can access URL parameters through the $_GET array. If Google were using PHP, they would set the variable like this:

$query = $_GET['q'];

If you don't want to send your information in the URL, there are other options like the $_POST, $_SESSION, and $_COOKIE arrays or a database. Note that whatever you use, you should always validate whatever information you collect before you execute the code or you will have serious security issues.
__________________
Want new web resources every day? - Follow me on
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by VirtuosiMedia; 05-07-2010 at 08:41 PM..
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 05-08-2010, 03:53 AM Re: what is this called? (noob question)
Junior Talker

Posts: 3
Name: i have no name
Trades: 0
Thanks for your post. I managed to get this code:
HTML Code:
<html>
<body><form name="input" action="redirect.php" method="get">
URL:
<input type="text" name="url" />
<input type="submit" value="Submit" />
</form>
<?php echo $_GET["url"]; ?>
</body>
</html>
but I want it so that when the user enters the URL and submits then the user is redirected to that URL, is there a way I can do that?
Thanks.
a124 is offline
Reply With Quote
View Public Profile
 
Old 05-08-2010, 03:56 AM Re: what is this called? (noob question)
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
You can redirect by using the header function. Just make sure you don't have any output prior to calling header.
PHP Code:
<?php
if(isset($_GET['url'])) :
     
header('Location: ' $_GET['url']);
else :
?>
<html>
<body><form name="input" action="redirect.php" method="get">
URL:
<input type="text" name="url" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
<?php endif; ?>
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by NullPointer; 05-08-2010 at 03:58 AM..
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Reply     « Reply to what is this called? (noob question)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.40630 seconds with 12 queries