Jump to content

Please help passing a PHP url parameter


Recommended Posts


I have a "tell a friend script" that opens a popup using javascript.

The script posts opens a popup containig a form like this:


var source = "friend_form.php";


My problem is that I need to also pass a URL parameter like so:


var source = "friend_form.php?id_property='<?php echo $row_properties_RS['id_property]?>'";


but it doesn't seem to work as the popup does not get the id_property passed.


I know I'm doing something wrong but can't figure it out



Link to comment
Share on other sites

Hi again,

I've tried this:



and then added this to the JS:


var source = '<?php echo $myVar ;?>';


but get this error:


Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\wamp\www\mysite\index.php on line 89


being line 89 this:




:confused: :confused: :confused: :confused: :confused: :confused:

Link to comment
Share on other sites

OK, here's the button you press to open the "tlla frind" popup


 <td width="6%"><a class="modal" href="javascript:void(0);"><img src="img/iconos/enviar_amigo.gif" width="21" height="17" border="0"  class="fixedTip"  title="enviar a un amigo" /></a></td>


this is my recordset and the $myVar variable that I use in the JS:


mysql_select_db($database_MySQLconnect, $MySQLconnect);
$query_destacadas_RS = "SELECT * FROM t_propiedades WHERE destacada = 1";
$destacadas_RS = mysql_query($query_destacadas_RS, $MySQLconnect) or die(mysql_error());
$row_destacadas_RS = mysql_fetch_assoc($destacadas_RS);
$totalRows_destacadas_RS = mysql_num_rows($destacadas_RS);

$myVar="friend_form.php?id_propiedad=". $row_destacadas_RS['id_propiedad'];


and this is the JS:


<script language="javascript">

  $(document).ready(function() {

    var source = '<?php echo $myVar ;?>';
    var width = 400;
    var align = "center";
    var top = 100;
    var padding = 10;
    var backgroundColor = "#FFFFFF";
    var borderColor = "#FFD200";
    var borderWeight = 4;
    var borderRadius = 5;
    var fadeOutTime = 300;
    var disableColor = "#666666";
    var disableOpacity = 40;
    var loadingImage = "images/loading.gif";

    //This method initialises the modal popup
    $(".modal").click(function() {

        modalPopup( align,
	    loadingImage );


    //This method hides the popup when the escape key is pressed
    $(document).keyup(function(e) {
        if (e.keyCode == 27) {




and still all I get is the same variable passed to  friend_form.php.....


any reasons why this is only passing the id_propiedad of the first record on my DB??



Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.