bhavin_85 Posted April 7, 2007 Share Posted April 7, 2007 hey guys i need the following code to open a pop up page. echo '<tr><td><a href="javascript:window.open('popup.php?filmid=".$filmid."','extrainfo','width=500,heigth=500,scrollbars=yes')"><img height='100' width='100' src='.$row["picture"].' ></td><td>'.$title.'</a></td><td>'.$price.'</td></tr>'; im getting a parse error the pop should have the filmid in it any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/46019-echo-parse-error/ Share on other sites More sharing options...
papaface Posted April 7, 2007 Share Posted April 7, 2007 do this: echo "<tr><td><a href=\"javascript:window.open('popup.php?filmid=".$filmid."','extrainfo','width=500,heigth=500,scrollbars=yes')\"><img height='100' width='100' src=".$row["picture"]." ></td><td>'.$title.'</a></td><td>'.$price.'</td></tr>"; Quote Link to comment https://forums.phpfreaks.com/topic/46019-echo-parse-error/#findComment-223606 Share on other sites More sharing options...
bhavin_85 Posted April 7, 2007 Author Share Posted April 7, 2007 hey mate ive put that echo in but the popup page jsut isnt opening at all <? session_start(); include('config.php'); $username = $_SESSION['username']; ?> <html> <head> <title>Online DVD Shop</title> </head> <body> <table align="center" valign="top" width="700" cols="3"> <tr> <td align="center" colspan="3"> <font size="+5">Online DVD Shop</font> </td></tr> <tr> <td align="left" valign="top" colspan="3"> <? $sql="SELECT customerid FROM regcustomer where username='$username'"; $query=mysql_query($sql); $row=mysql_fetch_assoc($query); $customerid=$row['customerid']; $sql2="SELECT name FROM customer WHERE customerid='$customerid'"; $query2=mysql_query($sql2); $row2=mysql_fetch_assoc($query2); $name=$row2['name']; if ( empty($_SESSION['username'])){ echo "<a href='login.php'>Login In or Register</a>"; } else { echo "Welcome to our online shop $name"; echo "<a href='logout.php'>Logout</a>"; } ?> </td></tr> <? $sql = "SELECT * FROM film"; $query=mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($query)) { $title = $row['title']; $price = $row['price']; $filmid = $row['filmid']; echo '<tr><td><a href="javascript:window.open(\'popup.php?filmid=\''.$filmid.'\',\'extrainfo\',\'width=500,heigth=500,scrollbars=yes\')"><img height=\'100\' width=\'100\' src=\''.$row["picture"].'\' ></td><td>'.$title.'</a></td><td>'.$price.'</td></tr>'; } //echo '<tr><td><img height"=100" width="100" src='.$row["picture"].' ></td><td><a href="popup.php?filmid='.$filmid.'">'.$title.'</a></td><td>'.$price.'</td></tr>'; ?> </table> </body> </html> heres the url ifyou want to see it http://www.xxx.yyyy.zz.uk/~abcde/default.php cheers Quote Link to comment https://forums.phpfreaks.com/topic/46019-echo-parse-error/#findComment-223614 Share on other sites More sharing options...
wildteen88 Posted April 7, 2007 Share Posted April 7, 2007 You now have an error with your javascript. Error: missing ) after argument list Source File: javascript:window.open('popup.php?filmid='A512','extrainfo','width=500,heigth=500,scrollbars=yes') Line: 1, Column: 31 Source Code: window.open('popup.php?filmid='A512','extrainfo','width=500,heigth=500,scrollbars=yes') Thats the error Firefox reports for me. Looks like you are not escaping your quotes properly. Tyr this as your echo query: echo '<tr> <td> <a href="javascript:window.open(\'popup.php?filmid='.$filmid.'\',\'extrainfo\',\'width=500,heigth=500,scrollbars=yes\')"><img height="100" width="100" src="' .$row['picture']. '" >'.$title.'</a> </td> <td>'.$price.'</td> </tr>'; Quote Link to comment https://forums.phpfreaks.com/topic/46019-echo-parse-error/#findComment-223624 Share on other sites More sharing options...
bhavin_85 Posted April 7, 2007 Author Share Posted April 7, 2007 ive had a crack at fixing it but im gettin this error Error: missing ) after argument list Source File: javascript:window.open('popup.php?filmid='A512','extrainfo','width=500,heigth=500,scrollbars=yes') Line: 1, Column: 31 Source Code: window.open('popup.php?filmid='A512','extrainfo','width=500,heigth=500,scrollbars=yes') should the filmid have the ' ' around A512? echo '<tr><td><a href="javascript:window.open(\'popup.php?filmid=\''.$filmid.'\',\'extrainfo\',\'width=500,heigth=500,scrollbars=yes\')"><img height=\'100\' width=\'100\' src=\''.$row["picture"].'\' ></td><td>'.$title.'</a></td><td>'.$price.'</td></tr>'; Quote Link to comment https://forums.phpfreaks.com/topic/46019-echo-parse-error/#findComment-223628 Share on other sites More sharing options...
wildteen88 Posted April 7, 2007 Share Posted April 7, 2007 no it shouldn't have quotes around it. Just remove them. URL variables do not have quotes wrapped around them. Quote Link to comment https://forums.phpfreaks.com/topic/46019-echo-parse-error/#findComment-223635 Share on other sites More sharing options...
bhavin_85 Posted April 7, 2007 Author Share Posted April 7, 2007 hey ok i have the pop up working but once the pop up window loads it shows [object] in the first window have a look at the link http://www.xxx.yyyy.zz.uk/~abcde/default.php click on any 1 of the images and you can see what i mean...any idea why this is happening? heres my code <? session_start(); include('config.php'); $username = $_SESSION['username']; ?> <html> <head> <title>Online DVD Shop</title> </head> <body> <table align="center" valign="top" width="700" cols="3"> <tr> <td align="center" colspan="3"> <font size="+5">Online DVD Shop</font> </td></tr> <tr> <td align="left" valign="top" colspan="3"> <? $sql="SELECT customerid FROM regcustomer where username='$username'"; $query=mysql_query($sql); $row=mysql_fetch_assoc($query); $customerid=$row['customerid']; $sql2="SELECT name FROM customer WHERE customerid='$customerid'"; $query2=mysql_query($sql2); $row2=mysql_fetch_assoc($query2); $name=$row2['name']; if ( empty($_SESSION['username'])){ echo "<a href='login.php'>Login In or Register</a>"; } else { echo "Welcome to our online shop $name"; echo "<a href='logout.php'>Logout</a>"; } ?> </td></tr> <? $sql = "SELECT * FROM film"; $query=mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($query)) { $title = $row['title']; $price = $row['price']; $filmid = $row['filmid']; echo '<tr><td><a href="javascript:window.open(\'popup.php?filmid='.$filmid.',extrainfo,width=500,heigth=500,scrollbars=yes\')"><img height=\'100\' width=\'100\' src=\''.$row["picture"].'\' ></td><td>'.$title.'</a></td><td>'.$price.'</td></tr>'; } ?> </table> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/46019-echo-parse-error/#findComment-223638 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.