Query string

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vfm
Forum Commoner
Posts: 32
Joined: Tue Mar 30, 2010 10:47 pm

Query string

Post 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.
Last edited by Weirdan on Mon Jul 26, 2010 1:04 pm, edited 1 time in total.
Reason: added syntax highlighting
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Query string

Post by requinix »

Easy indeed. $_GET is an array, not a function.

Code: Select all

$_GET["invoice"]
websitesca
Forum Newbie
Posts: 16
Joined: Fri Jul 09, 2010 2:47 pm

Re: Query string

Post 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
Post Reply