Page 1 of 1

simple coding problem- please help

Posted: Wed Jul 09, 2003 9:59 am
by sauron98
Hi everyone

This part of the script im modifing tells the browser to open up pages by cd_id

what i want to know is can i modify this piece of code to specify which cd I want it to print rather than it choosing. can i put the details in myself in that href line?...if so can anyone help me modify the line?....I need to specify the cds and stop it being a variable..catch what im saying?

excuse my coding ignorance
cheers
Dan

Code: Select all

<?php

function view(cd_id,cd_title,cd_image)
{
  win1=window.open("view_cd_image.php?cd_id="+cd_id+"&cd_title="+cd_title+"&cd_image="+cd_image,"main","");
<a href="" onClick="view('<?echo $row[cd_id];?>','<?echo $row[cd_title];?>','<?echo $row[cd_image];?>');return false;"> 
            <?php print "<img src='cd_image/$row[cd_image]' border='1' width=140 height=140>";?>
?>

Posted: Wed Jul 09, 2003 11:40 am
by m3rajk
assuming the page is show_cd.php, add the following line at the begining:
$cd_name=$_GET['cd_name'];

now if the page is clicked on and the link reads: show_cd.php?cd_name=40%20licks

$cd_name is 40%20licks (using urldecode you'll get 40 licks)