| | |
URL variables
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2008
Posts: 20
Reputation:
Solved Threads: 0
i need help in php
Here i m not getting $num value when i print echo $_GET['id'];
php Syntax (Toggle Plain Text)
<?php $num=2; ?> <a href="action.php?id='.$num.'">Text to be displayed</a>
Here i m not getting $num value when i print echo $_GET['id'];
Last edited by peter_budo; Nov 24th, 2008 at 6:14 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Use code tags.
Shouldn't be ?
I ask because you appear to be concatenating $num outside of a PHP block.
Shouldn't
html Syntax (Toggle Plain Text)
<a href="action.php?id='.$num.'">Text to be displayed</a>
html Syntax (Toggle Plain Text)
<a href="action.php?id=<?php echo $num; ?> ">Text to be displayed</a>
I ask because you appear to be concatenating $num outside of a PHP block.
Last edited by scru; Nov 23rd, 2008 at 10:19 am.
•
•
Join Date: Aug 2007
Posts: 189
Reputation:
Solved Threads: 14
Always enclose PHP stuff into a PHP block. The code should be:
or in this case printing a variable content:
Ops. Scru and me the same response. You can use the last example too.
<a href="action.php?id=<?php echo $num; ?>">Text to be displayed</a> or in this case printing a variable content:
<a href="action.php?id=<?=$num?>">Text to be displayed</a> Ops. Scru and me the same response. You can use the last example too.
Last edited by peter_budo; Nov 24th, 2008 at 6:13 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
![]() |
Similar Threads
- SQL Injection Attack (Database Design)
- PHP URL variables and if statement (PHP)
- Postback URL ? (ASP.NET)
- setting variable using url (ASP)
- how to get pass url variables from one page to another page with out knowing them? (ColdFusion)
- Retreiving a Variable from a URL (PHP)
- Google Trends (Search Engine Optimization)
Other Threads in the PHP Forum
- Previous Thread: PHP URL variables and if statement
- Next Thread: Php logic help
Views: 842 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl customizableitems database date directory display download dynamic echo email error file files folder form format forms forum function functions google headmethod href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail malfunctioning menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web xml youtube






