Click here to Skip to main content
15,888,984 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: How to hide "save as" button in IE11 Pin
John C Rayan15-Apr-16 3:44
professionalJohn C Rayan15-Apr-16 3:44 
GeneralISBT Barcode Pin
Praveen Kandari10-Apr-16 20:28
Praveen Kandari10-Apr-16 20:28 
GeneralRe: ISBT Barcode Pin
Richard MacCutchan10-Apr-16 20:50
mveRichard MacCutchan10-Apr-16 20:50 
QuestionOdd TypeError being thrown. Pin
Dralken5-Apr-16 9:57
Dralken5-Apr-16 9:57 
AnswerRe: Odd TypeError being thrown. Pin
Richard MacCutchan5-Apr-16 21:25
mveRichard MacCutchan5-Apr-16 21:25 
GeneralRe: Odd TypeError being thrown. Pin
Dralken5-Apr-16 21:31
Dralken5-Apr-16 21:31 
GeneralRe: Odd TypeError being thrown. Pin
Richard MacCutchan5-Apr-16 21:52
mveRichard MacCutchan5-Apr-16 21:52 
QuestionGet data from mysql database if checkbox is selected Pin
TaRoshka5-Apr-16 0:49
TaRoshka5-Apr-16 0:49 
Hello,

I am trying to built a kind of site where users can get data from database. Below you can see the
<a href="http://visitberat.com.al/MyNutri/NutriFacts">Site.</a>

Intro: Users through search form can search a category.
After submitting their request, they will be able to see all categories that contain the keyword.
If user wants to get more information for a specific product, they can select a checkbox and more data will be shown like the image provided within this<a href="http://i.imgur.com/9qGgHJk.png">link.</a>
Database is a single table with 52 columns. In the first search are shown only two colums. Other columns have to be posted after checkbox is selected.
Below you will find my code.
<pre lang="PHP"><html>
<head>

<title>Home | Mynutrifacts</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
<link href="css/animate.min.css" rel="stylesheet">
<link href="css/lightbox.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet">
<link href="css/responsive.css" rel="stylesheet">

<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
<link rel="shortcut icon" href="images/ico/favicon.ico">
</head>
<body>
<body>
<header id="header">
<div class="container">
<div class="row">
<div class="col-sm-12 overflow">
<div class="social-icons pull-right">
<ul class="nav nav-pills">
<li><a href=""><i class="fa fa-facebook"></i></a></li>
<li><a href=""><i class="fa fa-twitter"></i></a></li>
<li><a href=""><i class="fa fa-linkedin"></i></a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="navbar navbar-inverse" role="banner">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>

<a class="navbar-brand" href="index.html">
<h1><img src="images/logo.jpg" alt="logo"></h1>
</a>

</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li>
<form name="frmSearch" id="tfnewsearch" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>">
<table width="305">
<tr>
<th>
<input name="txtKeyword" type="text" id="txtKeyword" class="tftextinput" value="<?=$_GET["txtKeyword"];?>">
<input type="submit"class="tfbutton" value="Search"></th>
</tr>
</table>
</form>
</li>
<li class="active"><a href="index.php">Home</a></li>
<li><a href="aboutus.html">About</a></li>
<li><a href="contact.html">Contact us</a></li>
</ul>

</div>
</div>
</div>
</header>
<!--/#header-->
<section id="services">
<div class="container">
<div class="row">
<div class="col-sm-4 text-center padding wow fadeIn" data-wow-duration="1000ms" data-wow-delay="300ms">
<div class="single-service">
<div class="wow scaleIn" data-wow-duration="500ms" data-wow-delay="300ms">
<div id="tfheader">


<div class="tfclear"></div>
</div>
</div>
</div>

</div>
</div>

</div>
</div>
</section>


<?
if($_GET["txtKeyword"] != "")
{
$objConnect = mysql_connect("localhost","etlevabi_search","prova1990") or die(mysql_error());
$objDB = mysql_select_db("etlevabi_search");
// Search By Name or Email
$strSQL = "SELECT * FROM food WHERE (description LIKE '%".$_GET["txtKeyword"]."%')";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);


$Per_Page = 4; // Per Page

$Page = $_GET["Page"];
if(!$_GET["Page"])
{
$Page=1;
}

$Prev_Page = $Page-1;
$Next_Page = $Page+1;

$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{
$Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
$Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
$Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
}


$strSQL .=" order by foodid ASC LIMIT $Page_Start , $Per_Page";
$objQuery = mysql_query($strSQL);

?>
<table width="600" border="1" id="mytable">
<tr>
<th width="91"> <div align="center">Food ID </div></th>
<th width="98"> <div align="center">Description </div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td> <input name="check_list[]" type="checkbox" value="<?=$_GET["txtKeyword"];?>"><?=$objResult["foodid"];?></td>
<td><?=$objResult["description"];?></td>
</tr>
<?
}
?>
</table>
<br>
Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page :
<?
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtKeyword=$_GET[txtKeyword]'><< Back</a> ";
}

for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&txtKeyword=$_GET[txtKeyword]'>$i</a> ]";
}
else
{
echo "<b> $i </b>";
}
}
if($Page!=$Num_Pages)
{
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtKeyword=$_GET[txtKeyword]'>Next>></a> ";
}

mysql_close($objConnect);

}
?>

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/lightbox.min.js"></script>
<script type="text/javascript" src="js/wow.min.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</body>
</html></pre>

Thank you in advance!
QuestionNot really a question, but.... Pin
Wombaticus2-Apr-16 0:08
Wombaticus2-Apr-16 0:08 
AnswerRe: Not really a question, but.... Pin
Richard Deeming4-Apr-16 2:00
mveRichard Deeming4-Apr-16 2:00 
GeneralRe: Not really a question, but.... Pin
Wombaticus10-Apr-16 23:12
Wombaticus10-Apr-16 23:12 
AnswerRe: Not really a question, but.... Pin
F-ES Sitecore10-Apr-16 22:55
professionalF-ES Sitecore10-Apr-16 22:55 
GeneralRe: Not really a question, but.... Pin
Wombaticus10-Apr-16 23:11
Wombaticus10-Apr-16 23:11 
GeneralRe: Not really a question, but.... Pin
Richard Deeming11-Apr-16 1:25
mveRichard Deeming11-Apr-16 1:25 
GeneralRe: Not really a question, but.... Pin
Wombaticus11-Apr-16 1:33
Wombaticus11-Apr-16 1:33 
QuestionHow to hide the URL textbox using javascript Pin
zdbl20924-Mar-16 8:58
zdbl20924-Mar-16 8:58 
AnswerRe: How to hide the URL textbox using javascript Pin
Richard Deeming24-Mar-16 9:10
mveRichard Deeming24-Mar-16 9:10 
GeneralRe: How to hide the URL textbox using javascript Pin
zdbl20924-Mar-16 9:27
zdbl20924-Mar-16 9:27 
GeneralRe: How to hide the URL textbox using javascript Pin
Nathan Minier25-Mar-16 1:08
professionalNathan Minier25-Mar-16 1:08 
AnswerRe: How to hide the URL textbox using javascript Pin
ZurdoDev29-Mar-16 2:41
professionalZurdoDev29-Mar-16 2:41 
AnswerRe: How to hide the URL textbox using javascript Pin
F-ES Sitecore30-Mar-16 0:03
professionalF-ES Sitecore30-Mar-16 0:03 
AnswerRe: How to hide the URL textbox using javascript Pin
John C Rayan5-Apr-16 0:26
professionalJohn C Rayan5-Apr-16 0:26 
Questionjquery confirm dialogue box Pin
Member 1231770923-Mar-16 20:15
Member 1231770923-Mar-16 20:15 
AnswerRe: jquery confirm dialogue box Pin
Nathan Minier24-Mar-16 1:50
professionalNathan Minier24-Mar-16 1:50 
QuestionGroup by - Custom function Pin
NJdotnetdev22-Mar-16 3:19
NJdotnetdev22-Mar-16 3:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.