| | |
how to code single/double quotes inside the quotes.
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2005
Posts: 5
Reputation:
Solved Threads: 0
Below is my code. The problem is on the 'javascript:ViewPage(article_1.html)'; How to code the quote inside the ViewPage function since im using the
echo "....." ;
<?
echo "
<script language='javascript'>
function ViewPage(url)
{ OpenWin = this.open(url, 'CtrlWindow', 'toolbar=yes,menubar=yes,location=no,scrollbars=yes,resizable=yes');
}
</script>
<tr><td><a href='javascript:ViewPage(article_1.html)';>Article1</a></td><tr>
";
?>
it should be
<a href="javascript:ViewPage('article_1.html')";>Article1</a>
echo "....." ;
<?
echo "
<script language='javascript'>
function ViewPage(url)
{ OpenWin = this.open(url, 'CtrlWindow', 'toolbar=yes,menubar=yes,location=no,scrollbars=yes,resizable=yes');
}
</script>
<tr><td><a href='javascript:ViewPage(article_1.html)';>Article1</a></td><tr>
";
?>
it should be
<a href="javascript:ViewPage('article_1.html')";>Article1</a>
You can "escape" the quotes
that's just putting a \ before them. Tells PHP to leave them alone.
PHP Syntax (Toggle Plain Text)
<? echo " <script language='javascript'> function ViewPage(url) { OpenWin = this.open(url, 'CtrlWindow', 'toolbar=yes,menubar=yes,location=no,scrollbars=yes,resizable=yes'); } </script> <tr><td><a href='javascript:ViewPage(\"article_1.html\")';>Article1</a></td><tr> "; ?>
that's just putting a \ before them. Tells PHP to leave them alone.
•
•
•
•
Originally Posted by farheen
2. You should echo each line inidivdually.
For instance, lets say I have a function called getTable() I would expect it to return me a string of html formatted code for a table of data. I would then be able to call it with
echo getTable($result);
this will make the code faster and more modular. It probably takes us way beyond the original post but...
buried deep within my site I have some info on coding standards which also covers this.
Sarah
•
•
Join Date: Apr 2005
Posts: 19
Reputation:
Solved Threads: 0
actually.... i would do it like this (use straight html when you can... its quicker):
<? // does anything really need to be here? ?>
<script language="javascript">
function ViewPage(url)
{ OpenWin = this.open(url, 'CtrlWindow', 'toolbar=yes,menubar=yes,location=no,scrollbars=yes,resizable=yes');
}
</script>
<tr><td><a href="javascript:ViewPage('article_1.html');">Article1</a></td><tr>
otherwise.... echo 'a bunch of '.$stuff.' here';
or... echo "whatever you $want";
escaping works, but makes it a pain to move chunks of html out of <?php?> sections
good luck mediaphyte.com
<? // does anything really need to be here? ?>
<script language="javascript">
function ViewPage(url)
{ OpenWin = this.open(url, 'CtrlWindow', 'toolbar=yes,menubar=yes,location=no,scrollbars=yes,resizable=yes');
}
</script>
<tr><td><a href="javascript:ViewPage('article_1.html');">Article1</a></td><tr>
otherwise.... echo 'a bunch of '.$stuff.' here';
or... echo "whatever you $want";
escaping works, but makes it a pain to move chunks of html out of <?php?> sections
good luck mediaphyte.com
•
•
•
•
Originally Posted by mediaphyte
actually.... i would do it like this (use straight html when you can... its quicker):
<? // does anything really need to be here? ?>
<script language="javascript">
function ViewPage(url)
{ OpenWin = this.open(url, 'CtrlWindow', 'toolbar=yes,menubar=yes,location=no,scrollbars=yes,resizable=yes');
}
</script>
<tr><td><a href="javascript:ViewPage('article_1.html');">Article1</a></td><tr>
otherwise.... echo 'a bunch of '.$stuff.' here';
or... echo "whatever you $want";
escaping works, but makes it a pain to move chunks of html out of <?php?> sections
good luck mediaphyte.com
PHP4 OO: http://us2.php.net/oop/
PHP5 OO: http://us3.php.net/zend-engine-2.php
![]() |
Similar Threads
- Escape Sequences or Accepting Double Quotes in String Constants (Visual Basic 4 / 5 / 6)
Other Threads in the PHP Forum
- Previous Thread: form to mail - Hebrew problem
- Next Thread: Sokkit
Views: 12132 | Replies: 8
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl customizableitems database date directory display download dynamic echo email error file files folder form format forms forum function functions google headmethod href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail malfunctioning menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web xml youtube





