| | |
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 action ajax apache api array auto beginner binary bounce broken cakephp checkbox class cms code cron curl database date display dynamic echo email error errorlog file files folder form format forms function functions google href htaccess html image include insert integration interactive ip java javascript joomla limit link login loop mail malfunctioning masterthesis menu mlm mod_rewrite multiple mysql nodes oop paypal pdf php popup problem query radio ram random recursion reference regex remote return script search server sessions sms soap source space sql syntax system table tutorial unset update upload url validation validator variable video web websitecontactform xml youtube






