Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/46019-echo-parse-error/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/46019-echo-parse-error/#findComment-223614
Share on other sites

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>';

Link to comment
https://forums.phpfreaks.com/topic/46019-echo-parse-error/#findComment-223624
Share on other sites

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>';

Link to comment
https://forums.phpfreaks.com/topic/46019-echo-parse-error/#findComment-223628
Share on other sites

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>

Link to comment
https://forums.phpfreaks.com/topic/46019-echo-parse-error/#findComment-223638
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.