I want to upload a value to a page. For example, text. php & lt; ahref & quot; test. php? Id]; echo $ tt ;? & Gt; after entering the page, first judge if there is a value passed in, execute code 1, if there is no value passed in, execute code 2 this judgment is not good, do not know how to determine the page to pass the value
I want to upload a value on a page.
For example, text. php
Link
$ Tt = $ _ GET ['id'];
Echo $ tt;
?>
After entering the page, first determine if there is a value passed in, execute code 1, if there is no value passed in, execute code 2
I don't know how to judge this.
I have also seen other people's pages. a page with many passing values is its own, such as www.xxx.com/edit ....
What is the idea?
I often write a function. Do I have to write several php pages?
------ Solution --------------------
If (isset ($ tt ))
Code 1
Else
Code 2
------ Solution --------------------
Hello, www.xxx.com/edit....this form uses the framework technology, and I personally understand ZF (ZendFramework ). A framework technology in MVC mode can implement your ideas without using a large number of PHP files to implement a function.
There is a very good, very famous ZF entry Demo, address is http://akrabat.com/zend-framework-tutorial/
You can download his source code and PDF tutorials to learn the framework. then you will find that it will achieve the desired effect without knowing it! Success!
------ Solution --------------------
After entering the page, first determine if there is a value passed in, execute code 1, if there is no value passed in, execute code 2
PHP code
If (! Empty ($ _ GET ['id']) {// execute a $ id = intval ($ _ GET ['id']); include ('. /. php ');} else {// execute B include ('. /B. php ');}