Jump to content

<td> tag inside php...


karthikanov24

Recommended Posts

hi

 

 

<?php
echo "<td width=\"$columnWidth%\" align=\"center\"><a href=\"" . $_SERVER['PHP_SELF'] . "?c=$catId&p=$pd_id" . "\"><img src=\"$pd_thumbnail\" border=\"0\"><br>$pd_name</a><br>Price : $pd_price";
?>

 

In the above line of php code, whats the function of those slashes (\) ..?

 

why the slash is inside the double quotes,which is after c=$catID&p=$pd_id".

 

 

thanks

karthikanov24

 

Link to comment
Share on other sites

All strings are delimited (surrounded) by quotes. These can either be single quotes or double quotes. Whichever type you use, if you then wish to use that type of quote inside the string you need to escape them, otherwise PHP will think that is the end of the string. Escaping is done using a backslash.

 

. "?c=$catId&p=$pd_id" . "\">

 

The first double quote starts a string, the second one (after $pd_id) closes that string, the fullstop concatinates another string. The thrist double quote starts this string, then we need to output a double quote as part of the string (as a closing delimiter for the href attribute) so it is escaped. That particular code is a little odd in the fact that it uses a combination of techniques, but it's still correct.

Link to comment
Share on other sites

hi

in the following part of the above posted code,

<a href=\''".$_SERVER'PHP_SELF']."?=$catId&p=$pd_id". "\">

 

If the double quotes are replaced by single quotes as follows,its not working...

 

<a href=\'' ' .$_SERVER'PHP_SELF'].'?=$catId&p=$pd_id'. '\">

or

 

<a href=\' ".$_SERVER'PHP_SELF']."?=$catId&p=$pd_id". "\'>

or

 

<a href=\' ' .$_SERVER'PHP_SELF'].'?=$catId&p=$pd_id'. '\'>

 

 

why it so...?

could you explain me with an example <a href> tag...please..

 

thanks

karthikanov24

 

Link to comment
Share on other sites

hi

I tried to find the urls relating to the questions that i posted above by typing ,

 

"<td width=\"$columnWidth%\" align=\"center\"><a href=\"" . $_SERVER['PHP_SELF'] . "?c=$catId&p=$pd_id" . "\">

 

in the google search bar in google website......

 

but i did'nt get the correct url that explains me these things told by you..

 

So could you say me,what words should be typed in google search,to get the correct urls that deals with my above question....please...??

 

and thanks for your answers..

karthikanov24

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.