lingo5 Posted May 31, 2012 Share Posted May 31, 2012 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..... Quote Link to comment https://forums.phpfreaks.com/topic/263421-please-help-with-php-and-jqueryreally-stuck/ Share on other sites More sharing options...
zPlus Posted June 26, 2012 Share Posted June 26, 2012 You have probably spent 3 days because you don't know what problem you want to solve. You've posted tons of code and no precise definitions of what that script is supposed to do. Also, did you debug that code and what error messages did you get? Quote Link to comment https://forums.phpfreaks.com/topic/263421-please-help-with-php-and-jqueryreally-stuck/#findComment-1357136 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.