问题描述:

How to get a value of the $_GET?

E.G

How to get number 14 from action="doSomething.php?OrderNumber=14"

I know how to check if the orderNumber === "14", but I need to get this value and use it somewhere else.

Any suggestion much appreciated.

网友答案:

You can use $_GET['OrderNumber'] or $_REQUEST['OrderNumber']

网友答案:

The same as you would normally retrieve a GET variable:

$orderNumber = $_GET['orderNumber']; //Stores 14

You can find more information about $_GET here.

网友答案:

$_GET['var'] should be populated in url.php after form is submitted, $_GET['OrderNumber'] should be populated in doSomething.php after form is submitted, if this is not the answer, please elaborate.

网友答案:

If you dump $_GET using print_r for instance, you will notice that it is actually an key/value array. So if you want to get OrderNumber, you just have to use:

<?php
$order = (int)$_GET['OrderNumber']; #to unsure ordernumber is a number
// use $order anywhere you want
save($order); // for instance

in the file doSomething.php.

相关阅读:
Top