php - I can't print search result to MS Word -


i'm trying print search result ms word.

it not working instead displays in same html page.

here code:

viewstucon.php

<?php error_reporting(0); include("configsample.php"); ?> <?php  //asuume exporttoword input button clicked. if(isset($_post["exporttoword"])) { header("content-type: application/msword"); header("content-disposition: attachment; filename=database_dump.doc"); header("pragma: no-cache"); header("expires: 0");   if ($_request["course"]<>'') { $search_course = " , restu_course='".mysql_real_escape_string($_request["course"])."'"; }  if ($_request["from"]<>'' , $_request["to"]<>'') { $sql = "select * ".$settings["data_table"]." restu_year between '".mysql_real_escape_string($_request["from"])."' , '".mysql_real_escape_string($_request["to"])."'".$search_course; } else if ($_request["from"]<>'') { $sql = "select * ".$settings["data_table"]." restu_year = '".mysql_real_escape_string($_request["from"])."'".$search_course; } else if ($_request["to"]<>'') { $sql = "select * ".$settings["data_table"]." restu_year = '".mysql_real_escape_string($_request["to"])."'".$search_course; } else { $sql = "select * ".$settings["data_table"]." restu_id>0".$search_course; }  $sql_result = mysql_query ($sql, $connection ) or die ('request "could not execute sql query" '.$sql); while ($row = mysql_fetch_assoc($sql_result)) { echo '<tr style="font:normal 12px tahoma; color:#333333;"> <td style="padding:10px;">'.$row['restu_title'].'</a></td> <td style="padding:10px;">'.$row['restu_year'].'</td> <td style="padding:10px;">'.$row['restu_by'].'</td> </tr>'; } } ?> <html> <title>home</title> <head> <meta charset="utf-8"> <title>flat login form</title> </head>  <body>   <form class="login-form" method="post" action="viewstucon.php"> <select class="s" id="course" name="course"> <option value="">select course</option> <option value="bachelor of secondary education"<?php if (!(strcmp("bachelor of secondary education", $_post["course"]))) {echo "selected=\"selected\"";} ?>>bachelor of secondary education</option> <option value="bachelor of science in automotive technology"<?php if (!(strcmp("bachelor of science in automotive technology", $_post["course"]))) {echo "selected=\"selected\"";} ?>>bachelor of science in automotive technology</option> <option value="bachelor of science in electrical technology"<?php if (!(strcmp("bachelor of science in electrical technology", $_post["course"]))) {echo "selected=\"selected\"";} ?>>bachelor of science in electrical technology</option> </select> <input class="sy" name="from" type="text" id="from" size="10" width="100%" value="<?php echo $_request["from"]; ?>" placeholder="from"/> <input class="sy" name="to" type="text" id="to" size="10" width="100%" value="<?php echo $_request["to"]; ?>" placeholder="to"/> <button type="submit" name="submit" >filter</button> <input type="submit" name="exporttoword" value = "export word" /> </form>  <table width="100%" border="1" style="border: 1px solid #999999; border-collapse: collapse; margin:0 auto; background:#ffffff; border-radius:20px;"> <tr style="background:#3366cc; color:#ffffff; font:normal 15px tahoma; height:40px;"> <th>research title</th> <th>year</th> <th>proponent(s)</th> </tr> <?php //asuume filter input button clicked. if ($_request["course"]<>'') { $search_course = " , restu_course='".mysql_real_escape_string($_request["course"])."'"; } if ($_request["from"]<>'' , $_request["to"]<>'') { $sql = "select * ".$settings["data_table"]." restu_year between '".mysql_real_escape_string($_request["from"])."' , '".mysql_real_escape_string($_request["to"])."'".$search_course; } else if ($_request["from"]<>'') { $sql = "select * ".$settings["data_table"]." restu_year = '".mysql_real_escape_string($_request["from"])."'".$search_course; } else if ($_request["to"]<>'') { $sql = "select * ".$settings["data_table"]." restu_year = '".mysql_real_escape_string($_request["to"])."'".$search_course; } else { $sql = "select * ".$settings["data_table"]." restu_id>0".$search_course; }  $sql_result = mysql_query ($sql, $connection ) or die ('request "could not execute sql query" '.$sql); if (mysql_num_rows($sql_result)>0) { while ($row = mysql_fetch_assoc($sql_result)) { echo'<tr style="font:normal 12px tahoma; color:#333333;"> <td style="padding:10px;">'.$row['restu_title'].'</a></td> <td style="padding:10px;">'.$row['restu_year'].'</td> <td style="padding:10px;">'.$row['restu_by'].'</td> </tr>'; } }else { echo'<tr><td colspan="5">no results found.</td>'; } ?> </table>  </body> </html> 


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -