Jump to content
Hank

Where can I find an answer to this very easy question?

Recommended Posts

I want to use two variables contained un a URL:

www.mysite/mypage.php?number=12345&word=hello

How do I retrieve these variables into my PHP?

Share this post


Link to post
Share on other sites

$_GET['number'], etc... others may include $_POST (for items submitted by a form) and $_REQUEST (does both GET or POST in one)

Share this post


Link to post
Share on other sites

Given your example: 

 

 

www.mysite/mypage.php?number=12345&word=hello

 

mypage.php

<?php
error_reporting(E_ALL);
ini_set('display_errors',1);

if (isset($_GET['number']))
{
	$number = $_GET['number'];
}

if (isset($_GET['word']))
{
	$word = $_GET['word'];
}

Share this post


Link to post
Share on other sites

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.