Hey guys, below is my code, I am working on trying to PASS Variables to a popup window. I have it to where it show the embed window(which is blank) link, the title(which is blank) and instuctions(which is blank), but I cannot get it to pass the variables of what I want to the popup window. I will also append the popup window for you. Thanks everyone for your help.
<!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=utf-8" />
<title>Exercise Video Library</title>
<link href="twoColHybLtHdr.css" rel="stylesheet" type="text/css" /><!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.twoColHybLtHdr #sidebar1 { padding-top: 30px; }
.twoColHybLtHdr #mainContent { zoom: 1; padding-top: 15px; }
/* the above proprietary zoom property gives IE the hasLayout it may need to avoid several bugs */
</style>
<![endif]-->
<script type="text/javascript">
function showactiveLink(){
document.getElementById("arrow").innerHTML = "<img src='images/smallArrow.gif'>";
}
</script>
<script type="text/javascript">
function loadwindow(page){
window.open(page,"popup","width=560,height=800,status=1")
}
</script>
</head>
<body onload="showactiveLink()" class="twoColHybLtHdr">
<div id="container">
<div id="header">
<div><h1><font color="red">Exercise Video Library</font></h1></div>
<div id="search-form" align="right"><form id="search-block-form" action="search.php" method="get"><input type="text" name="q" /><input id="divbutton" title="Search" name="search" alt="Search" type="submit" value="" /></form></div>
<div align="right" id="contactinfo">Contact Us: (719) 576-2256</div>
<div align="Center" id="navigation"><a href="index.html">Home</a> | <a href="library.html">Excercise Library</a> | Tutorials | Sample Workouts | <a href="design-your-workout.html">Design Your Workout</a> | Health & Fitness Assessment </div>
<!-- end #header --></div>
<div> </div>
<div> </div>
<div id="sidebar1">
<h3>Quick Links</h3>
<li>Master Food list</li><br />
<li>Workout/Nutrition Logs</li><br />
<li>Fitness Terms & Definations</li><br />
<li>Rehbilitation Tips</li>
<li>Injury Recovery</li>
<!-- end #sidebar1 --></div>
<div id="mainContent">
<div class="textwidget">
<?php
$hostname_logon = "omited" ;
$database_logon = "omited" ;
$username_logon = "omited" ;
$password_logon = "omited" ;
//open database connection
$connections = mysql_connect($hostname_logon, $username_logon, $password_logon) or die ( "Unable to connect to the database" ). mysql_error();
//select database
mysql_select_db($database_logon) or die ( "Unable to select database!" );
//specify how many results to display per page
$limit = 5;
//get the search variable from URL
$var = mysql_real_escape_string(@$_REQUEST['q']);
//get pagination
$s = mysql_real_escape_string($_REQUEST['s']);
//set keyword character limit
if(strlen($var) < 3){
$resultmsg = "<p>Search Error</p><p>Keywords with less then three characters are omitted...</p>" ;
}
//trim whitespace from the stored variable
$trimmed = trim($var);
$trimmed1 = trim($var);
//separate key-phrases into keywords
$trimmed_array = explode(" ",$trimmed);
$trimmed_array1 = explode(" ",$trimmed1);
// check for an empty string and display a message.
if ($trimmed == "") {
$resultmsg = "<p>Search Error</p><p>Please enter a search...</p>" ;
}
// check for a search parameter
if (!isset($var)){
$resultmsg = "<p>Search Error</p><p>We don't seem to have a search parameter! </p>" ;
}
// Build SQL Query for each keyword entered
foreach ($trimmed_array as $trimm){
//If MATCH query doesn't return any results due to how it works do a search using LIKE
if($row_num_links_main < 1){
$query = "SELECT title, id, keywords, catagories, emurl FROM libvid WHERE keywords LIKE '%$trimm%' OR catagories LIKE '%$trimm%' ORDER BY title DESC";
$numresults=mysql_query ($query);
$row_num_links_main1 =mysql_num_rows ($numresults);
}
// next determine if 's' has been passed to script, if not use 0.
// 's' is a variable that gets set as we navigate the search result pages.
if (empty($s)) {
$s=0;
}
// now let's get results.
$query .= " LIMIT $s,$limit" ;
$numresults = mysql_query ($query) or die ( "Couldn't execute query" );
$row= mysql_fetch_array ($numresults);
//store record id of every item that contains the keyword in the array we need to do this to avoid display of duplicate search result.
do{
$adid_array[] = $row[ 'title' ];
}while( $row= mysql_fetch_array($numresults));
} //end foreach
//Display a message if no results found
if($row_num_links_main == 0 && $row_num_links_main1 == 0){
$resultmsg = "<p>Search results for: ". $trimmed."</p><p>Sorry, your search returned zero results</p>" ;
}
//delete duplicate record id's from the array. To do this we will use array_unique function
$tmparr = array_unique($adid_array);
$i=0;
foreach ($tmparr as $v) {
$newarr[$i] = $v;
$i++;
}
//total result
$row_num_links_main = $row_num_links_main + $row_num_links_main1;
// now you can display the results returned. But first we will display the search form on the top of the page
echo '<form action="search.php" method="get">
<div>
<input name="q" type="text" value="'.$q.'">
<input name="search" type="submit" value="Search">
</div>
</form>';
// display an error or, what the person searched
if( isset ($resultmsg)){
echo $resultmsg;
}else{
echo "<p>Search results for: <strong>" . $var."</strong></p>";
foreach($newarr as $value){
// EDIT HERE and specify your table and field unique ID for the SQL query
$query_value = "SELECT * FROM libvid WHERE title = '".$value."'";
$num_value=mysql_query ($query_value);
$row_linkcat= mysql_fetch_array ($num_value);
$row_num_links= mysql_num_rows ($num_value);
//create summary of the long text. For example if the field2 is your full text grab only first 130 characters of it for the result
$introcontent = strip_tags($row_linkcat[ 'title']);
$introcontent = substr($introcontent, 0, 130)."...";
//now let's make the keywods bold. To do that we will use preg_replace function.
//Replace field
$title = preg_replace ( "'($var)'si" , "<strong>\\1</strong>" , $row_linkcat[ 'title' ] );
$desc = preg_replace ( "'($var)'si" , "<strong>\\1</strong>" , $introcontent);
$link = preg_replace ( "'($var)'si" , "<strong>\\1</strong>" , $row_linkcat[ 'emurl' ] );
$cata = preg_replace ( "'($var)'si" , "<strong>\\1</strong>" , $row_linkcat[ 'catagories' ] );
$instr = preg_replace ( "'($var)'si" , "<strong>\\1</strong>" , $row_linkcat[ 'instructions' ] );
foreach($trimmed_array as $trimm){
if($trimm != 'b' ){
$title = preg_replace( "'($trimm)'si" , "<strong>\\1</strong>" , $title);
$desc = preg_replace( "'($trimm)'si" , "<strong>\\1</strong>" , $desc);
$link = preg_replace( "'($trimm)'si" , "<strong>\\1</strong>" , $link);
$cata = preg_replace( "'($trimm)'si" , "<strong>\\1</strong>" , $cata);
$instr = preg_replace( "'($trimm)'si" , "<strong>\\1</strong>" , $instr);
}//end highlight
}//end foreach $trimmed_array
//format and display search results
echo '<div class="search-result">';
echo '<div class="search-title">Video Title: '.$title.'</div>';
echo '<div class="search-link">';
echo '<a href="#" onClick="javascript:loadwindow(\'popup.php?view&var1=$title&var2=$link&var3=$instr \')"><img src=http://i3.ytimg.com/vi/'.$link.'/0.jpg width="236" height="147" /></a>';
echo '</div>';
echo '<div class="search-cata">';
echo '<p><font size="-2" >Catagories: '.$cata. '</font></p>';
echo '</div>';
echo '<br />';
echo '<br />';
echo '</div>';
} //end foreach $newarr
if($row_num_links_main > $limit){
// next we need to do the links to other search result pages
if ($s >=1) { // do not display previous link if 's' is '0'
$prevs=($s-$limit);
echo '<div class="search_previous"><a href="'.$PHP_SELF.'?s='.$prevs.'&q='.$var.'">Previous</a>
</div>';
}
// check to see if last page
$slimit =$s+$limit;
if (!($slimit >= $row_num_links_main) && $row_num_links_main!=1) {
// not last page so display next link
$n=$s+$limit;
echo '<div class="search_next"><a href="'.$PHP_SELF.'?s='.$n.'&q='.$var.'">Next</a>
</div>';
}
}//end if $row_num_links_main > $limit
}//end if search result
?>
</div>
<h2> </h2>
<p></p>
<!-- end #mainContent --></div>
<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats -->
<br class="clearfloat" />
<div id="footer">
<div id="footernav"><font color="#FFFFFF" size="-2">Contact Us | Help/FAQs | <a href="terms.html">Terms of Service</a> | <a href="privacy.html">Privacy Policy</a> | Partners/Affiliate Program</font><div id="copyrightinfo" align="right"><font color="#FFFFFF" size="-2">Copyright © 2013: Exercise Video Library</font></div></div>
<!-- end #footer --></div>
<!-- end #container --></div>
</body>
</html>
Here is the code for the popup window.
<!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=utf-8" />
<title></title>
</head>
<body>
<?php
$_GET['var1'];
$_GET['var2'];
$_GET['var3'];
echo '<div class="search-result">';
echo '<div class="search-title">Video Title: '.$var1.'</div>';
echo '<div class="search-link">';
echo '<iframe width="560" height="315" src="http://www.youtube.com/embed/'.$var2.'&loop=1" frameborder="0" allowfullscreen></iframe>';
echo '</div>';
echo '<div class="search-cata">';
echo '<p>Instructions: '.$var3.'</p>';
echo '</div>';
echo '<br />';
echo '<br />';
echo '</div>';
?>
</body>
</html>