Current location: Hot Scripts Forums » Programming Languages » PHP » <a href > inside php

<a href > inside php

Reply
  #1 (permalink)  
Old 11-01-09, 06:39 AM
karthikanov24 karthikanov24 is offline
Newbie Coder
 
Join Date: Sep 2009
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
<a href > inside php

hi

Code:
echo "<a href=\" " . $_SERVER['PHPSELF'] . "?c=$catId&p=$pd_id" . "\">link</a>";
the value of $_SERVER['PHP_SELF'] is /plaincart/index.php in my application

There are totally 8 double quotes present in the above code.

The second and seventh double quotes are similar to "abc.php" in <a href="abc.php"> {an example}

But why third and sixth double quotes and concatination (.) which is present before and after
$_SERVER['PHPSELF'] . "?c=$catId&p=$pd_id"
is used??

thanks
karthikanov24
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-01-09, 06:47 AM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 2,838
Thanks: 13
Thanked 11 Times in 10 Posts
Quote:
Originally Posted by karthikanov24 View Post
Code:
echo "<a href=\" " . $_SERVER['PHPSELF'] . "?c=$catId&p=$pd_id" . "\">link</a>";
But why third and sixth double quotes and concatination (.) which is present before and after
$_SERVER['PHPSELF'] . "?c=$catId&p=$pd_id"
is used??
They're being used to jump in and out of the print statement so the value of "$_SERVER['PHPSELF']" can be inserted inline.
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data (scroll down)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 11-01-09, 10:53 PM
wirehopper's Avatar
wirehopper wirehopper is offline
Community Liaison
 
Join Date: Feb 2006
Posts: 1,563
Thanks: 2
Thanked 25 Times in 25 Posts
PHP_SELF has security vulnerabilities: PHP Tutorials Examples PHP Security
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 11-03-09, 04:41 AM
Neville1985's Avatar
Neville1985 Neville1985 is offline
New Member
 
Join Date: Nov 2009
Location: Australia
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
I rather doing this:
PHP Code:
echo "<a href=\"{$_SERVER['PHP_SELF']}?c=$catId&p=$pd_id\">link</a>"
Saves on escaping the string, less typing, whitespace blah blah. My personal taste
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 03:22 AM
Html > PHP Sango PHP 2 06-16-04 08:55 AM
Form -> text file -> php variables Bonzo PHP 1 06-16-04 08:37 AM
100 Web Templates & 10 PHP Scripts for sale! HostersUK.co.uk General Advertisements 0 01-10-04 01:31 AM
Inserting PHP forum inside layout page xeoh PHP 1 12-18-03 07:34 PM


All times are GMT -5. The time now is 06:57 AM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.