blivori Posted July 20, 2011 Share Posted July 20, 2011 Hi, I have two pages - one containing hyperlinks from search results (search.php) and one that needs to be passed a variable (index.htm) Search results on the search.php page are stored in a MySQL database. I want that when a user clicks on a link, the hyperlink is passed to index.htm Here's the code for the two pages: Search.php: <?php mysql_connect ("localhost", "admin","root") or die (mysql_error()); mysql_select_db ("files"); $term = $_POST['term']; $sql = mysql_query("select * from files_tbl where Name like '%$term%'"); echo '<font size="7px" face="Calibri"><b> Search Results:</b></font>'; while ($row = mysql_fetch_array($sql)){ echo '<br><br/><font size="5px" face="Calibri"> Name: '.$row['Name']; $path = "/pdf/"; //$pdf = ".pdf"; $fullpath = $path.$row['Name']; //.$pdf; echo '<br/><font size="3px" face="Calibri"><b><a href='. $fullpath .'>'.$row['Name'] . '</a></font></b>'; $sql_path = "INSERT INTO files.files_tbl(Path, Name) Values ('$fullpath','$row[Name]')"; mysql_query($sql_path) or die('Error, Insert query failed' . mysql_error()); } ?> index.htm: <!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" lang="en" xml:lang="en"> <head> <title>FlexPaper</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css" media="screen"> html, body { height:100%; } body { margin:0; padding:0; overflow:auto; } #flashContent { display:none; } </style> <script type="text/javascript" src="js/flexpaper_flash.js"></script> </head> <body> <div style="position:absolute;left:10px;top:10px;"> <a id="viewerPlaceHolder" style="width:660px;height:480px;display:block"></a> <script type="text/javascript"> var fp = new FlexPaperViewer( 'FlexPaperViewer', 'viewerPlaceHolder', { config : { SwfFile : escape('Paper.swf'), Scale : 0.6, ZoomTransition : 'easeOut', ZoomTime : 0.5, ZoomInterval : 0.2, FitPageOnLoad : true, FitWidthOnLoad : true, PrintEnabled : false, FullScreenAsMaxWindow : true, ProgressiveLoading : false, MinZoomSize : 0.2, MaxZoomSize : 5, SearchMatchAll : true, InitViewMode : 'Portrait', ViewModeToolsVisible : false, ZoomToolsVisible : true, NavToolsVisible : true, CursorToolsVisible : true, SearchToolsVisible : true, localeChain: 'en_US' }}); </script> </div> <!-- THE FOLLOWING CODE BLOCK CAN SAFELY BE REMOVED, IT IS ONLY PLACED HERE TO HELP YOU GET STARTED. --> <div style="position:absolute;left:680px;height:540px;top:10px;font-family:Verdana;font-size:9pt;background-color:#CACACA;width:300px"> <div style="padding: 5px 5px 5px 5px;font-size:15px;font-weight:bold;text-align:center;margin-top:10px;">FlexPaper Sample Document</div> <div style="padding: 5px 5px 5px 5px;font-size:11px;text-align:left;margin-bottom:10px;">Can't see the document and running FlexPaper from your local directory?<br/><br/> Upload the contents of the zip file to a web server or make FlexPaper trusted to run locally. You can manage your trusted flash applications at <a href="http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04a.html#119065">Adobe's website</a>.</div> <div style="background-color:#EFEFEF"> <div style="padding: 5px 5px 5px 5px;font-size:15px;font-weight:bold;text-align:center;margin-top:50px;">More Examples</div> <div style="padding: 5px 5px 5px 5px;font-size:11px;text-align:left;margin-bottom:10px;line-height:150%"> » <a href="examples/two_page.html">FlexPaper starting up in Two-Page mode</a><br/> » <a href="examples/interactive_API.html">Interactive API html page</a><br/> » <a href="examples/searchmatchall.html">Search and highlight all matches</a><br/> </div> <div style="padding: 5px 5px 5px 5px;font-size:15px;font-weight:bold;text-align:center;margin-top:50px;">Publishing with PHP</div> <div style="padding: 5px 5px 5px 5px;font-size:11px;text-align:left;margin-bottom:10px;line-height:150%"> » <a href="php/simple_document.php">On the fly conversion (requires PHP5)</a><br/> » <a href="php/split_document.php">Split file conversion (requires PHP5)</a> </div> <div style="padding: 5px 5px 5px 5px;font-size:15px;font-weight:bold;text-align:center;margin-top:50px;">Documentation</div> <div style="padding: 5px 5px 5px 5px;font-size:11px;text-align:left;margin-bottom:10px;line-height:150%"> » <a href="http://flexpaper.devaldi.com/docs_php.jsp">Configuring and Publishing with PHP</a><br/> » <a href="http://flexpaper.devaldi.com/docs_converting.jsp">Converting Documents</a><br/> » <a href="http://flexpaper.devaldi.com/docs_parameters.jsp">Parameters</a><br/> » <a href="http://flexpaper.devaldi.com/docs_api.jsp">API</a><br/> </div> </div> </div> </body> </html> Theres an attached image of search.php Any suggestions please? Anmy help would be appreciated. Thanks & Regards, blivori [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/242411-passing-a-variable-to-another-page-on-click/ Share on other sites More sharing options...
AyKay47 Posted July 20, 2011 Share Posted July 20, 2011 not sure exactly what you are trying to do here, are you saying that when a user clicks on one of the links, you want them to be directed to index.html with the data of the link that they clicked on? Quote Link to comment https://forums.phpfreaks.com/topic/242411-passing-a-variable-to-another-page-on-click/#findComment-1245122 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.