Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. {include file='globalheader.tpl'}
  2. <div id="xx">
  3. <form action="handler.php" method="post" >
  4. <input type="number" name="barcode" value="1" />
  5. <input type="submit" value="Submit" name="submit" />
  6. </form >
  7. </div>
  8. {include file='globalfooter.tpl'}
  9.  
  10. {require_once('c:/xxx/Smarty/Smarty.class.php');
  11. $smarty = new Smarty();
  12. $host = "xxx";
  13. $user = "xxx";
  14. $password = "xxx";
  15. $database_name = "xxx";
  16. $pdo = new PDO("mysql:host=$host;dbname=$database_name", $user, $password, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
  17.  
  18. $search=$_POST['barcode'];
  19. $query = $pdo->prepare("SELECT * FROM xxx WHERE xxx LIKE '$search' LIMIT 0 , 10");
  20. $query->bindValue(1, "$search", PDO::PARAM_STR);
  21. $query->execute();
  22.  
  23. $results = $query->fetch();
  24.  
  25. $smarty->assign('output', '$results');
  26. $smarty->display('results.tpl')
  27.  
  28. {include file='globalheader.tpl'}
  29. <div id="xx">
  30. {$output}
  31. </div>
  32. {include file='globalfooter.tpl'}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement