Jump to content

Recommended Posts

I have a "tell a friend" script in jquery and i am having hell trying to make it work with a php variable.

 

This is the button that opens the popup:

 

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

 

this is the variable that gets the id_propiedad variable y need to insert in the jquery code:

 

<?php 
$refurl = "friend_form.php?id_propiedad=" . $row_destacadas_RS['id_propiedad'];
?>

 

this is the jquery code to open the popup window:

 


<script language="javascript" src="js/jquery.js"></script>
<script language="javascript" src="js/modal.popup.js"></script>
<script language="javascript">

  $(document).ready(function() {

    var source = "<?php echo $refurl;?>";
    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,
	    top,
	    width,
	    padding,
	    disableColor,
	    disableOpacity,
	    backgroundColor,
	    borderColor,
	    borderWeight,
	    borderRadius,
	    fadeOutTime,
	    source,
	    loadingImage );

    });	

    //This method hides the popup when the escape key is pressed
    $(document).keyup(function(e) {
        if (e.keyCode == 2456) {
            closePopup(fadeOutTime);
        }
    });

  });

</script>

 

and this is the code for the friend_form.php where the variable from the jquery script should be sent:

 

<?php require_once('Connections/MySQLconnect.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_form_RS = "-1";
if (isset($_GET['id_propiedad'])) {
  $colname_form_RS = (get_magic_quotes_gpc()) ? $_GET['id_propiedad'] : addslashes($_GET['id_propiedad']);
}
mysql_select_db($database_MySQLconnect, $MySQLconnect);
$query_form_RS = sprintf("SELECT * FROM t_propiedades WHERE id_propiedad = %s", GetSQLValueString($colname_form_RS, "int"));
$form_RS = mysql_query($query_form_RS, $MySQLconnect) or die(mysql_error());
$row_form_RS = mysql_fetch_assoc($form_RS);
$totalRows_form_RS = mysql_num_rows($form_RS);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="webassist/button_styles/css_buttons.css" rel="stylesheet" type="text/css" />
<link href="css/rfernan.css" rel="stylesheet" type="text/css" />
</head>

<body>
<form name=refer action="processors/referer.php?id_propiedad=$colname_form_RS" method="POST"><td align="center" valign="middle"><table width="400" border="0" align="center" cellpadding="8" cellspacing="0">
  <tr>
    <td height="30" colspan="2"><?php echo $refurl;?></td>
  </tr>
  <tr>
  <td height="30" colspan="2"><strong>
Tus datos 
    
  </strong></td></tr> <tr><td width="210" height="30">
tu nombre:<input name="fromName" type="text" id="fromName"></td><td width="358" height="30">
tu email:<input name="fromEmail" type="text" id="fromEmail"></td></tr> <tr><td height="30" colspan="2"><strong>
Datos de tu amigo</strong></td></tr><tr><td height="30">
su nombre:<input name="toName" type="text" id="toName"></td><td height="30">
tu email:<input name="toEmail" type="text" id="toEmail"></td></tr><tr align="center">
  <td height="30" colspan="2">
<input name="Submit" type="submit" class="RedBookblue3" value="Refer"></td></tr> </table></td></form>
</body>
</html>
<?php
mysql_free_result($form_RS);
?>

 

I have spent 3 days trying to solve this...and i'm really stuck.....

  • 4 weeks later...
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.