p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: Simple question on quotations


Message #1 by Jefferis Peterson <jefferis@p...> on Tue, 22 Oct 2002 09:31:49 -0400
I asked this question differently, now let me put it simply:

When you put html within php and echo to print html data, do you change the
double quotes inside the html and javascript to single quotation marks and
put the entire html inside double quotes?

> <td valign="middle">
> <div align="center">
>         <p><a href="#"  onclick="MM_openBrWindow('<?php echo
> "show_image.php?img={$row_viewall['pictures']}"; $img 
> $row_viewall['pictures'];?>','','toolbar=yes,scrollbars=yes,resizable=yes,wi
> dth=550,height=500');return false">

Would be 

<?php echo "<td valign='middle'>";
 echo "<div align='center'>";
    echo      "<p><a href='#'  onclick='MM_openBrWindow(' ?><?php echo
"show_image.php?img={$row_viewall['pictures']}"; $img 
$row_viewall['pictures'];?> etc...

IF so, what happens to the single quotes in the html/javascript?  Do you
have to escape them????

Jeff


The reason I need to to this is that I need to make the whole html cell
structure of a table conditional. I don't want 2 cells to appear if there is
no data in it... 


~~~~~~~~~~~~
Jefferis Peterson, Pres.
Web Design and Marketing
http://www.PetersonSales.net
Tel .  xxx-xxx-xxxx
ICQ 19112253

http://www.Slippery-Rock.com - 7,000 hits per year

Message #2 by "Gellings, C.O." <gellingsco@p...> on Tue, 22 Oct 2002 19:46:37 +0200
yes but you could use \" to get double quotes if required i.e.

<? echo "<input type=\"text\" onChange=\"javascript: functioneName('param1,
param2, ...')\">";?>

because if jou call a function which requires params you'll need the quotes
for the parameters to differ from those of the event.

Carl

-----Original Message-----
From: Jefferis Peterson [mailto:jefferis@p...]
Sent: 22 October 2002 15:32
To: beginning php
Subject: [beginning_php] Simple question on quotations


I asked this question differently, now let me put it simply:

When you put html within php and echo to print html data, do you change the
double quotes inside the html and javascript to single quotation marks and
put the entire html inside double quotes?

> <td valign="middle">
> <div align="center">
>         <p><a href="#"  onclick="MM_openBrWindow('<?php echo
> "show_image.php?img={$row_viewall['pictures']}"; $img 
>
$row_viewall['pictures'];?>','','toolbar=yes,scrollbars=yes,resizable=yes,wi
> dth=550,height=500');return false">

Would be

<?php echo "<td valign='middle'>";
 echo "<div align='center'>";
    echo      "<p><a href='#'  onclick='MM_openBrWindow(' ?><?php echo
"show_image.php?img={$row_viewall['pictures']}"; $img 
$row_viewall['pictures'];?> etc...

IF so, what happens to the single quotes in the html/javascript?  Do you
have to escape them????

Jeff


The reason I need to to this is that I need to make the whole html cell
structure of a table conditional. I don't want 2 cells to appear if there is
no data in it...


~~~~~~~~~~~~
Jefferis Peterson, Pres.
Web Design and Marketing
http://www.PetersonSales.net
Tel .  xxx-xxx-xxxx
ICQ 19112253

http://www.Slippery-Rock.com - 7,000 hits per year




  Return to Index