Hello,

I'm working on a hardware project based on the RabbitSys chips, which are ideal for web based hardware development. My task now is to divide a table up in pages and i'm able to set a variable from a webpage like "CurrentPage=1" and calculate my way around. the ZHTML is a bit like PHP, just a little different. I never worked with PHP before though, and the question is how are the vars in URLs called? for example

http://www.daniweb.com/forums/newthread.php?do=newthread&f=17

in this URL some var called "f" is set to 17. I want to know how this method is called in PHP so i don't have to work my way through 850 pages of datasheets teehee. The problem is i really have no clue on where to look for from this point. Base of the system is already done, only the webfront needs a little touch-up.

here's a link to the page with datasheets and language manuals if anyone's interested. Most of the ZHTML is descripted in the TCP/IP Vol 2.

Thanks in advance,

K

I never worked with PHP before though, and the question is how are the vars in URLs called?

When someone visits your page and the url to your page contains variables like site.com/test.php?f=17&s=23 , the PHP engine automatically creates a global array named $_GET which gets "stuffed" with the url parameters. Thus, given the sample url above you can see the values by echoing them as follows:

echo $_GET['f'];
echo $_GET['s'];

You can of course simply assign those values to some other variable: $F=$_GET['f']; and then do whatever you want/need with $F On the other hand, if you have a string that is formatted like a URL, you can use parse_str() (http://us.php.net/manual/en/function.parse-str.php) to "extract" the parameters in the url yourself - basically doing exactly what the PHP engine does automatically when initializing $_GET :

$str="site.com/test.php?f=17&s=23";
parse_str($str,$param);

echo $param['f'];
echo $param['s'];

I see. zHTML calls 'em HTTP condition state vars. Dynamic C does not automatically create an array for them. I'm marking this thread answered though, thanks for the info. Learned me some PHP yet again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.