Page 1 of 1

Query string

Posted: Mon Jul 26, 2010 4:37 am
by vfm
Hi,

For something so simple I cannot get it to work.

I have a page e.g. http://www.blah.com/send?invoice=12345

On this page I'm trying to grab the invoice id to use in a query. The code looks like:

Code: Select all

<?php

$invoice = $_GET('invoice');
echo $invoice;

?>
But I'm getting the following error:
Fatal error: Function name must be a string

Any ideas on this? I'm relatively new to PHP so it's probably something easy.

Re: Query string

Posted: Mon Jul 26, 2010 6:04 am
by requinix
Easy indeed. $_GET is an array, not a function.

Code: Select all

$_GET["invoice"]

Re: Query string

Posted: Mon Jul 26, 2010 1:03 pm
by websitesca
You're just making a simple syntax mistake. You want to use $_GET like as if it were an array:

Code: Select all

$invoice_no = $_GET["invoice"];
Easy no?

Hope that helps!

www.websites.ca - Website Design for Small Canadian Businesses