Jump to content

[SOLVED] passing values through url


sushantkaura

Recommended Posts

hey guys ,

i have a lil problem .

 

i have 2 php pages in which value has to be passed between the two

the function open_win() is used to open the page in a new window and is defined above the code as it is a java script . 

 

a.php

................

function open_win()

{

window.open("player.php?songId=<?=$songid?>")

}

 

 

 

 

 

$songid=$row['Cid'];

echo "<td>"?><input type=button value="Listen" onClick="open_win()"/><?php "</td>";

 

 

.......................

second page

player.php i m typing

 

.......................

 

 

 

$sid=$_GET["songId"];

echo "$sid";

 

 

.......................

 

i have done like this but in player.php it is not echoing the value and not even in the url of the next window,

 

is it the rite way to id ? i think i m doing something wrong .

plz tell me the rite way to do it.

sushant

Link to comment
https://forums.phpfreaks.com/topic/77505-solved-passing-values-through-url/
Share on other sites

Change your function to this

 

function open_win(songID)
{
window.open("player.php?songId="+ songID)
}

 

Now to call the function, do this

<?php

$songid=$row['Cid'];
echo "<td><input type=button value='Listen' onClick='open_win($songid)'/></td>";

?>

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.