Jump to content

Having a problem making this work ??


illuz1on

Recommended Posts

hey, this is how my code looks at the moment for viewing MORE INFO on the NAME of a beach..

 

 

echo "<b>$name</b>" . "-" . "<a href=viewdetails.php?id=".$id."> More Info</a><br>";

 

I want to make that open up in a new window without scrollbars and etc, can anyone help me do this? Thanks

Link to comment
https://forums.phpfreaks.com/topic/42669-having-a-problem-making-this-work/
Share on other sites

heres some javascript to do the trick

 

<script type="text/javascript">
<!--Hide script from old browsers
function newWindow(newContent)
{
  winContent = window.open(newContent, 'nextWin', 'right=0, top=20,width=792,height=570, toolbar=no,scrollbars=no, resizable=no')
}
//Stop hiding script from old browsers -->
</script>

use this for url:
<a href="javascript:newWindow('page.html')">View page</a>

Thanks mfindlay..

 

 

Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/capetown/public_html/view.php on line 33

 

Trying to do this now:

 

// Echo beaches name  + More Info link

 

echo "<b>$name</b>" . "-" . "<a href=viewdetails.php?id=".$id."> More Info</a><br>";

 

 

echo "<a href="javascript:newWindow('viewdetails.php?id=\".$id.\"')">$name</a>";

 

and ideas?

Thanks for the quick responses guys, much appreciated..

 

I tried that and it doesnt seem to create the link properly..

 

http://www.capetownalive.co.za/view.php

 

Below is the code of view.php

 

<script type="text/javascript">

<!--Hide script from old browsers

function newWindow(newContent)

{

  winContent = window.open(newContent, 'nextWin', 'right=0, top=20,width=792,height=570, toolbar=no,scrollbars=no, resizable=no')

}

//Stop hiding script from old browsers -->

</script>

 

<?php

 

require_once("db.php");

 

//select statement example ok all book entry's lol.

$sql = "SELECT * FROM beaches";

$data = mysql_query($sql);

while($record = mysql_fetch_assoc($data)) {

 

// Short vars

 

$id = $record['id'];

$name = $record['name'];

$picture = $record['picture'];

$rating = $record['rating'];

$sdesc = $record['sdesc'];

 

 

// Echo beaches name  + More Info link

 

 

 

echo "(<a href=\"javascript:newWindow('viewdetails.php?id=\"'.$id.'\"')\">'.$name.'</a>)";

 

 

}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.