| | |
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
| Thread Tools | Search this Thread |
.htaccess ajax alerts apache api array autocomplete beginner binary broken cakephp checkbox class cms code convert cron curl database date display dynamic echo email emptydisplayvalue error errors explodefunction file files folder form forms function functions google hack href htaccess html htmlspecialchars image include insert integration ip java javascript joomla keywords limit link login loop mail menu methods mlm multiple mysql network object oop paypal pdf php problem query radio random recursion recursive redirect regex remote script search securephp server sessions shot sms soap source space sql syntax system table tutorial update upload url validation validator variable video web xml youtube






