Jump to content

php script that can grab a variable from a different php


faux

Recommended Posts

I'm a little confused on how this will exactly work. Can you possibly show an example?

 

www.example.com/script.php?arg1=something&arg2=somethingelse&arg3=blah

arg1=something
arg2=somethingelse
arg3=blah

 

Those are variables passed by the URL and retrieved via $_GET. The "?" denotes all things passed after it are variables. The "&" seperates variables from each other. With this method you can pass variables across as many scripts as you want.

 

You can pass these variables in a FORM or you can pass them as URLs.

 

You get the variables like this:

 

$x = $_GET['arg1'];
$y = $_GET['arg2'];
$z = $_GET['arg3'];

$x === "something";
$y === "somethingelse";
$z === "blah";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.