Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 06-03-2008, 11:37 AM Pop-Up in PHP
one7media's Avatar
Novice Talker

Posts: 8
Name: Preston
Trades: 0
Sorry if this is uber newbie, but that's me:

I'm trying to insert a javascript pop-up. Here's the code I'm having trouble with:

Code:
echo "<td valign=\"center\">";
         echo "<div style='width:100%; height:100%; vertical-align: center;'>";
           echo "<a href=\"javascript:newWindow('sendemail.php?'+document.location.href,'email',400,300,'')">Recommend this page to your friend</a>" style=display: block;>";

             echo "<span>";
It's throwing this error:

Code:
Parse error:  syntax error, unexpected T_STRING, expecting ',' or ';' in /home/***/***/tomp.one7media/components/com_marketplace/topmenu.php on line 104
Line 104 being the echo "<a href=\

I appreciate any help!
one7media is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-03-2008, 11:46 AM Re: Pop-Up in PHP
Arenlor's Avatar
Ultra Talker

Posts: 462
Name: Jerod Lycett
Location: /home/arenlor
Trades: 0
You forgot to escape some quotes, these two:
)">Recommend this page to your friend</a>
My suggestion is when you're echoing HTML to use single quotes. I found it actually requires less coding in the end.
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Old 06-03-2008, 11:57 AM Re: Pop-Up in PHP
one7media's Avatar
Novice Talker

Posts: 8
Name: Preston
Trades: 0
I'm getting there. I removed "Recommend...." because the output is called from the language file.

Here's the problem:

It's not appearing as a link. Here's the block:

Code:
echo "<td valign=\"center\">";
         echo "<div style='width:100%; height:100%; vertical-align: center;'>";

           echo "<a href=\"javascript:newWindow('sendemail.php?'+document.location.href,'email',400,300,'')">" style=display: block;>";

             echo "<span>";
               echo "<img src=\"".$mosConfig_live_site."/components/com_marketplace/images/system/writead.gif\" border=\"0\" align=\"top\" >";
             echo "</span>";
             echo "&nbsp;&nbsp;&nbsp;";

             echo "<span>";
               echo JOO_TELL_FRIEND;
             echo "</span>";

           echo "</a>";
         echo "</div>";
       echo "</td>";
This is what the result is:



It should be a link to pop-up the tell a friend form and I don't know why the "1" is in front of the image.

I'm a total newb and I'm sure it's something stupid.
one7media is offline
Reply With Quote
View Public Profile
 
Old 06-03-2008, 12:29 PM Re: Pop-Up in PHP
Arenlor's Avatar
Ultra Talker

Posts: 462
Name: Jerod Lycett
Location: /home/arenlor
Trades: 0
First off, you need to fix this:
style=display: block;
Add quotes to it.
I'm no expert on javascript, but http://www.pageresource.com/jscript/jwinopen.htm does that help you at all? Also do you have a URL to test this with?
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Old 06-03-2008, 12:54 PM Re: Pop-Up in PHP
one7media's Avatar
Novice Talker

Posts: 8
Name: Preston
Trades: 0
I get this error in Firebug:

Code:
unterminated string literal
newWindow('sendemail.php?'+document.location.href,'email',400,300,'') 'style=\di...
one7media is offline
Reply With Quote
View Public Profile
 
Old 06-04-2008, 12:29 AM Re: Pop-Up in PHP
Arenlor's Avatar
Ultra Talker

Posts: 462
Name: Jerod Lycett
Location: /home/arenlor
Trades: 0
Here's a serving of copy pasta for you, just use this code.
PHP Code:
echo '<td valign="center">';
    echo 
'<div style="width:100%; height:100%; vertical-align: center;">';
        echo 
'<a href="javascript:window.open(\'sendemail.php?\'+document.location.href,\'email\',400,300,\'\')"> style="display: block;>"';
            echo 
'<span>';//Why an empty span?
                
echo '<img src="'.$mosConfig_live_site.'/components/com_marketplace/images/system/writead.gif" border="0" align="top" >';
            echo 
'</span>';
            echo 
'&nbsp;&nbsp;&nbsp;';
            echo 
'<span>';//Why TWO empty spans?
                
echo JOO_TELL_FRIEND//Is this correct?
            
echo '</span>';
        echo 
'</a>';
    echo 
'</div>';
echo 
'</td>'
Why do you use the two empty spans, and what is the JOO_TELL_FRIEND thing? Also I'm no expert on javascript but your link would open a new window that if I'm not mistaken would be http://www.example.com/path/to/sendm...th/to/page.php
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Old 06-07-2008, 01:10 AM Re: Pop-Up in PHP
Novice Talker

Posts: 10
Trades: 0
All you have to do is to scape the " inside the Php code:

Quote:
)">Recommend this page to your friend</a>"
Must be:

Quote:
)\">Recommend this page to your friend</a>\"
__________________
Dream to be alive!

Please login or register to view this content. Registration is FREE

&
Please login or register to view this content. Registration is FREE
apolo13 is offline
Reply With Quote
View Public Profile
 
Old 06-07-2008, 04:32 AM Re: Pop-Up in PHP
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
^ This person has just done my biggest pet hate -.- .. that question has been answerd
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Reply     « Reply to Pop-Up in PHP
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.27686 seconds with 12 queries