Jump to content

nicedad

Members
  • Content Count

    38
  • Joined

  • Last visited

Community Reputation

0 Neutral

About nicedad

  • Rank
    Member
  1. nicedad

    pop up window

    didn't work, never mind I'll create the message as a link to another page that includes that message thanks a lot
  2. nicedad

    pop up window

    Yeah I tried it with it and I removed it only to test the code. still not working! you can test it online under this link. http://a-integrationsdienste.ch/datenbank.php <?php session_start(); require_once("common/DAO.php"); require_once("./common/config.php"); require_once("classes/class.users.php"); require_once("services/MemberService.php"); $objUser = new User(); $city = ""; $occupation = ""; $searchCondition = ""; if(!empty($_POST["search"])) { foreach($_POST["search"] as $k=>$v){ if(!empty($v)) { $queryCases = array("city","occupation"); if(in_array($k,$queryCases)) { $searchCondition .= " AND "; } switch($k) { case "city": $city = $v; $searchCondition .= "city LIKE '" . $v . "%'"; break; case "occupation": $occupation = $v; $searchCondition .= "occupation LIKE '" . $v . "%'"; break; } } } } $userList = $objUser->getMember($searchCondition); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Integrationsdienste</title> <link href="css/style.css" rel="stylesheet" type="text/css" /> <meta name="description" content=""> <meta name="author" content="templatemo"> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/templatemo_justified.css" rel="stylesheet"> <script type="text/javascript" src="js/jquery/jquery-1.9.1.js"></script> <script type="text/javascript" src="js/bootstrap.js"></script> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="js/html5shiv.js"></script> <script src="js/respond.min.js"></script> <![endif]--> <style> .btnjoin { padding: 5px 20px; border-radius: 4px; margin-bottom: 10px; color: #F0F8FF; background-color: #3CB6CB; border: none; cursor: pointer; } .table-striped>tbody>tr:nth-child(odd)>td, .table-striped>tbody>tr:nth-child(odd)>th { background-color: #DDDDDD; } .table-striped>tbody>tr:nth-child(odd)>th {/*table header color*/ background-color: #3CB6CB; /*it was #bbb*/ } .space5 { margin-top: 5px; } body { background-color: #F3FFF3; } </style> <script> window.onload = function() { function notify(e) { e.preventDefault(); alert("Please contact admin to download CV's"); } links = document.getElementsByClassName('cv-download'); for(i = 0; i < links.length; i++ ) { links[i].addEventListener('click', notify); } } </script> </head> <body> <div id="container" class="container"> <a href="http://www.templatemo.com/preview/templatemo_382_simplex" rel="nofollow"> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="468" height="60" <param name="movie" value="banner.swf"<param name="quality" value="high" /><param name="bgcolor" value="#ffffff"/> <embed src="banner.swf" quality="high" bgcolor="#ffffff" width="1140" height="300" name="banner" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> </embed></object> </a> <ul class="nav nav-justified"> <ul class="nav nav-justified"> <li class=""><a href="index.html">Home</a></li> <li><a href="aboutus.html">Über Uns</a></li> <li><a href="service.html">Service</a></li> <li><a href="datenbank.php">Datenbank</a></li> <li><a href="jobs.html">Jobs</a></li> <li><a href="kontakt.html">Contact</a></li> </ul> <div class="row space30"> <!-- row 1 begins --> <div class="col-md-12"> <a href="login.php" class="btnjoin pull-right" style="padding:5px 29px;margin-right:10px;">Login/ Anmelden</a> <a href="jobs.php" class="btnjoin pull-right" style="padding:5px 29px;margin-right:10px;">Jobs</a> <a href="datenbank.php" class="btnjoin pull-right" style="padding:5px 29px;margin-right:10px;">Bewerber</a> <?php if(!empty($userList["total_records"])) { ?> <div class="left"> <span style="color: #240CF7"><strong> <?php echo $userList["total_records"]; ?></strong></span> <span style="color: #0E3CEF; font-size: 14px;">Bewerber verfügbar </span></div> <?php } ?> <form method="post"> <div class="row space30"> <!-- row 2 begins --> <div class="col-md-12 text-center"> <?php $userCity = $objUser->getCity(); ?> <select name="search[city]" style="min-width: 150px;padding: 3px;margin-right:25px;"> <option value="">Kanton auswählen</option> <?php if(!empty($userCity)) { foreach($userCity as $k=>$v) { ?> <option value="<?php echo $userCity[$k]["city"]; ?>" <?php if($userCity[$k]["city"] == $city) { echo "selected"; } ?>> <?php echo $userCity[$k]["city"]; ?></option> <?php } } ?> </select> <?php $userOccupation = $objUser->getOccupation(); ?> <select name="search[occupation]" style="min-width: 150px;padding: 3px;"> <option value="">Beruf auswählen</option> <?php if(!empty($userOccupation)) { foreach($userOccupation as $k=>$v) { ?> <option value="<?php echo $userOccupation[$k]["occupation"]; ?>" <?php if($userOccupation[$k]["occupation"] == $occupation) { echo "selected"; } ?>> <?php echo $userOccupation[$k]["occupation"]; ?></option> <?php } } ?> </select> <input type="submit" name="go" value="Search" style="border-color: none;border: 2px outset buttonface;padding: 2px 45px;margin-left: 20px;" > <input type="reset" value="Reset" style="border-color: none;border: 2px outset buttonface;padding: 2px 45px;margin-left: 10px;" onclick="window.location='datenbank.php'"> </div> </div> <?php if(!empty($userList)) { ?> <div class="row space5"> <!-- row 3 begins --> <div class="col-md-12"> <table class="table table-striped"> <tr> <th style="width: 14%;">Person</th> <th style="width: 14%;">About Me</th> <th style="width: 8%;">Geburtstag</th> <th style="width: 12%;">Staadsangehörigkeit</th> <th style="width: 10%;">Aufenthalt</th> <th style="width: 12%;">Kontakt</th> <th style="width: 10%;">Kanton</th> <th style="width: 12%;">Berufswunsch</th> <th style="width: 8%;">Lebenslauf</th> </tr> <?php foreach($userList as $i => $value) { if(is_numeric($i)) { ?> <tr> <td><?php echo $userList[$i]["name"]; ?></td> <td><?php echo $userList[$i]["about_me"]; ?></td> <td><?php echo $userList[$i]["date_of_birth"]; ?></td> <td><?php echo $userList[$i]["country_origin"]; ?></td> <td><?php echo $userList[$i]["permit"]; ?></td> <td><?php echo $userList[$i]["contact"]; ?></td> <td><?php echo $userList[$i]["city"]; ?></td> <td><?php echo $userList[$i]["occupation"]; ?></td> <?php if ($_SESSION['type_of_logged_in_user'] == "company") { ?> <td><a href="<?php echo $userList[$i]["cv_path"]; ?>" class="cv-download">Download</a></td> <td><a href="<?php echo $userList[$i]["cv_path"]; ?>" class="cv-download"></td> <?php } else { ?> <td><a class="login_first_messg" href="#">Download</a></td> <?php } ?> </tr> <?php } }//for close ?> </table> </div> </div> <?php if(!empty($userList["perpage"])) { ?> <div class="pagination center"><?php echo $userList["perpage"]; ?></div> <?php } ?> <?php }//if close ?> </form> <!-- Site footer --> <div class="footer"> <p></div><div class="footer"><p><center>© Copyright 2015 | Ausländer und Integrations Dienste | <a rel="nofollow" href="http://www.a-Integrationsdienste.ch">www.a-Integrationsdienste.ch</a></center> </div> </div> <!-- /container --> <!-- Bootstrap core JavaScript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> </ul> </body> </html>
  3. nicedad

    pop up window

    Hellon Ch0cu3r I added the code you suggested in it's place unfortunately has no effect, therefore I post the entire code to see whether I did a mistake or not. please notice that the code was proposed to enable logged user (companies) to download any CV. plase see end od code. <!DOCTYPE html> <html lang="en"> <head> <style> .btnjoin { padding: 5px 20px; border-radius: 4px; margin-bottom: 10px; color: #F0F8FF; background-color: #3CB6CB; border: none; cursor: pointer; } .table-striped>tbody>tr:nth-child(odd)>td, .table-striped>tbody>tr:nth-child(odd)>th { background-color: #DDDDDD; } .table-striped>tbody>tr:nth-child(odd)>th {/*table header color*/ background-color: #3CB6CB; /*it was #bbb*/ } .space5 { margin-top: 5px; } body { background-color: #F3FFF3; } </style> <script> window.onload = function() { function notify(e) { e.preventDefault(); alert("Please contact admin to download CV's"); } links = document.getElementsByClassName('cv-download'); for(i = 0; i < links.length; i++ ) { links[i].addEventListener('click', notify); } } </script> </head> <body> <div id="container" class="container"> <a href="http://www.templatemo.com/preview/templatemo_382_simplex" rel="nofollow"> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="468" height="60" <param name="movie" value="banner.swf"<param name="quality" value="high" /><param name="bgcolor" value="#ffffff"/> <embed src="banner.swf" quality="high" bgcolor="#ffffff" width="1140" height="300" name="banner" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> </embed></object> </a> <ul class="nav nav-justified"> <ul class="nav nav-justified"> <li class=""><a href="index.html">Home</a></li> <li><a href="aboutus.html">Über Uns</a></li> <li><a href="service.html">Service</a></li> <li><a href="datenbank.php">Datenbank</a></li> <li><a href="jobs.html">Jobs</a></li> <li><a href="kontakt.html">Contact</a></li> </ul> <div class="row space30"> <!-- row 1 begins --> <div class="col-md-12"> <a href="login.php" class="btnjoin pull-right" style="padding:5px 29px;margin-right:10px;">Login/ Anmelden</a> <a href="jobs.php" class="btnjoin pull-right" style="padding:5px 29px;margin-right:10px;">Jobs</a> <a href="datenbank.php" class="btnjoin pull-right" style="padding:5px 29px;margin-right:10px;">Bewerber</a> <?php if(!empty($userList["total_records"])) { ?> <div class="left"> <span style="color: #240CF7"><strong> <?php echo $userList["total_records"]; ?></strong></span> <span style="color: #0E3CEF; font-size: 14px;">Bewerber verfügbar </span></div> <?php } ?> <form method="post"> <div class="row space30"> <!-- row 2 begins --> <div class="col-md-12 text-center"> <?php $userCity = $objUser->getCity(); ?> <select name="search[city]" style="min-width: 150px;padding: 3px;margin-right:25px;"> <option value="">Kanton auswählen</option> <?php if(!empty($userCity)) { foreach($userCity as $k=>$v) { ?> <option value="<?php echo $userCity[$k]["city"]; ?>" <?php if($userCity[$k]["city"] == $city) { echo "selected"; } ?>> <?php echo $userCity[$k]["city"]; ?></option> <?php } } ?> </select> <?php $userOccupation = $objUser->getOccupation(); ?> <select name="search[occupation]" style="min-width: 150px;padding: 3px;"> <option value="">Beruf auswählen</option> <?php if(!empty($userOccupation)) { foreach($userOccupation as $k=>$v) { ?> <option value="<?php echo $userOccupation[$k]["occupation"]; ?>" <?php if($userOccupation[$k]["occupation"] == $occupation) { echo "selected"; } ?>> <?php echo $userOccupation[$k]["occupation"]; ?></option> <?php } } ?> </select> <input type="submit" name="go" value="Search" style="border-color: none;border: 2px outset buttonface;padding: 2px 45px;margin-left: 20px;" > <input type="reset" value="Reset" style="border-color: none;border: 2px outset buttonface;padding: 2px 45px;margin-left: 10px;" onclick="window.location='datenbank.php'"> </div> </div> <?php if(!empty($userList)) { ?> <div class="row space5"> <!-- row 3 begins --> <div class="col-md-12"> <table class="table table-striped"> <tr> <th style="width: 14%;">Person</th> <th style="width: 14%;">About Me</th> <th style="width: 8%;">Geburtstag</th> <th style="width: 12%;">Staadsangehörigkeit</th> <th style="width: 10%;">Aufenthalt</th> <th style="width: 12%;">Kontakt</th> <th style="width: 10%;">Kanton</th> <th style="width: 12%;">Berufswunsch</th> <th style="width: 8%;">Lebenslauf</th> </tr> <?php foreach($userList as $i => $value) { if(is_numeric($i)) { ?> <tr> <td><?php echo $userList[$i]["name"]; ?></td> <td><?php echo $userList[$i]["about_me"]; ?></td> <td><?php echo $userList[$i]["date_of_birth"]; ?></td> <td><?php echo $userList[$i]["country_origin"]; ?></td> <td><?php echo $userList[$i]["permit"]; ?></td> <td><?php echo $userList[$i]["contact"]; ?></td> <td><?php echo $userList[$i]["city"]; ?></td> <td><?php echo $userList[$i]["occupation"]; ?></td> <?php if ($_SESSION['type_of_logged_in_user'] == "company") { ?> <!--<td><a href="<?php echo $userList[$i]["cv_path"]; ?>">Download</a></td> --> <td><a href="<?php echo $userList[$i]["cv_path"]; ?>" class="cv-download"></td> <?php } else { ?> <td><a class="login_first_messg" href="#">Download</a></td> <?php } ?> </tr> <?php } }//for close ?> </table> </div> </div> <?php if(!empty($userList["perpage"])) { ?> <div class="pagination center"><?php echo $userList["perpage"]; ?></div> <?php } ?> <?php }//if close ?> </form> <!-- Site footer --> <div class="footer"> <p></div><div class="footer"><p><center>© Copyright 2015 | Ausländer und Integrations Dienste | <a rel="nofollow" href="http://www.a-Integrationsdienste.ch">www.a-Integrationsdienste.ch</a></center> </div> <div id="login-first-messg-modal" class="modal fade" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> </div> <div class="modal-body"> You have to <a href="login.php">login</a> first as Employer on this site to download C.V. </div> </div> </div> </div> <script type="text/javascript"> $('.login_first_messg').on('click', function(e) { $("#login-first-messg-modal").modal({}); e.preventDefault(); }); </script> </body> </html>
  4. nicedad

    pop up window

    Hi Ch0cu3r, thanks alot for your reply. couple questions please; should the class be in the body? is the java script a stand alone file or within the PHP code? please advice as am just fan for PHP. best,
  5. nicedad

    pop up window

    Hi everyone, I created a database table that includes a link to CV's (see attached image). I need the following action to be done; if someone clicks on the link to any CV, he gets a pop-up window notifying a message to contact the Admin. Here is a snapshot of the code ?> <tr> <td><?php echo $userList[$i]["name"]; ?></td> <td><?php echo $userList[$i]["about_me"]; ?></td> <td><?php echo $userList[$i]["date_of_birth"]; ?></td> <td><?php echo $userList[$i]["country_origin"]; ?></td> <td><?php echo $userList[$i]["permit"]; ?></td> <td><?php echo $userList[$i]["contact"]; ?></td> <td><?php echo $userList[$i]["city"]; ?></td> <td><?php echo $userList[$i]["occupation"]; ?></td> <?php if ($_SESSION['type_of_logged_in_user'] == "company") { ?> <td><a href="<?php echo $userList[$i]["cv_path"]; ?>">Download</a></td> <?php } else { ?> <td><a class="login_first_messg" href="#">Download</a></td> <?php } ?> </tr> <?php } }//for close ?> </table> </div> </div>
  6. nicedad

    search a MySql table using PHP

    Barand you're really life-saver this was it thanx so much
  7. nicedad

    search a MySql table using PHP

    of course not, the attached image shows the bug. furthermore you can check it out live using this link http://a-integrationsdienste.ch/jobs.php and search for any word in column (Firmenname or Job Title) i.e. tester or akram you will see the error
  8. nicedad

    search a MySql table using PHP

    true, I forget it. here is the code again. still the same error. <?php session_start(); require_once("common/DAO.php"); require_once("./common/config.php"); require_once("classes/class.jobs.php"); require_once("services/MemberService.php"); $objUser = new Jobs(); $location = ""; $Jqualify = ""; $userList = $objUser->getJobs($searchCondition); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Integrationsdienste</title> <link href="css/style.css" rel="stylesheet" type="text/css" /> <meta name="description" content=""> <meta name="author" content="templatemo"> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/templatemo_justified.css" rel="stylesheet"> <style> .btnjoin { padding: 5px 20px; border-radius: 4px; margin-bottom: 10px; color: #F0F8FF; background-color: #3CB6CB; border: none; cursor: pointer; } .table-striped>tbody>tr:nth-child(odd)>td, .table-striped>tbody>tr:nth-child(odd)>th { background-color: #DDDDDD; } .table-striped>tbody>tr:nth-child(odd)>th { background-color: #bbb; } .space5 { margin-top: 5px; } p.test { width: 27em; word-wrap: break-word; } </style> </head> <body> <div id="container" class="container"> <?php if(isset($_POST['submit'])){ if(isset($_GET['go'])){ if(preg_match("/^[ a-zA-Z]+/", $_POST['search'])){ $name=$_POST['search']; //connect to the database $db=mysql_connect ("localhost", "MyDB", "pass") or die ('I cannot connect to the database because: ' . mysql_error()); //-select the database to use $mydb=mysql_select_db("eandagroup"); //-query the database table $sql="SELECT comp_name, jobtitle, job_description, location FROM jobs WHERE comp_name LIKE '%" . $name . "%' OR jobtitle LIKE '%" . $name ."%'"; //-run the query against the mysql query function $result=mysql_query($sql); ?> </div> </div> <?php if(!empty($result)) { ?> <div class="row space5"> <!-- row 3 begins --> <div class="col-md-12"> <table class="table table-striped"> <tr> <th style="width: 10%;">Firmenname</th> <th style="width: 10%;">Job Title</th> <th style="width: 30%;">Job Beschreibung</th> <th style="width: 10%;">Erfahrung</th> <th style="width: 10%;">Kanton</th> <th style="width: 10%;">Branche</th> <th style="width: 10%;">Vertragsart</th> <th style="width: 10%;">Gehalt/ Stunde</th></tr> <?php while($row=mysql_fetch_array($result)) { ?> <tr> <td><?php echo $CompName=$row['comp_name'];?></td> <td><?php echo $JobTitle=$row['jobtitle'];?></td> <td><?php echo $JobDest=$row[$i]["job_description"];?></td> <td><?php echo $Location=$row[$i]["location"];?></td> </tr> <?php } ?> </table> </div> </div> <?php if(!empty($userList["perpage"])) { ?> <div class="pagination center"><?php echo $userList["perpage"]; ?></div> <?php } ?> <?php }//if close ?> // here is the error, which I don't where it come from! </body> </html>
  9. nicedad

    search a MySql table using PHP

    unfortunately not, the missing code is at the end before </body> please guys help
  10. nicedad

    search a MySql table using PHP

    Hi, thanks again. I did what you suggested but still have one error by </table> could you help please. here is the code <?php session_start(); require_once("common/DAO.php"); require_once("./common/config.php"); require_once("classes/class.jobs.php"); require_once("services/MemberService.php"); $objUser = new Jobs(); $location = ""; $Jqualify = ""; $userList = $objUser->getJobs($searchCondition); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Integrationsdienste</title> <link href="css/style.css" rel="stylesheet" type="text/css" /> <meta name="description" content=""> <meta name="author" content="templatemo"> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/templatemo_justified.css" rel="stylesheet"> <style> .btnjoin { padding: 5px 20px; border-radius: 4px; margin-bottom: 10px; color: #F0F8FF; background-color: #3CB6CB; border: none; cursor: pointer; } .table-striped>tbody>tr:nth-child(odd)>td, .table-striped>tbody>tr:nth-child(odd)>th { background-color: #DDDDDD; } .table-striped>tbody>tr:nth-child(odd)>th { background-color: #bbb; } .space5 { margin-top: 5px; } p.test { width: 27em; word-wrap: break-word; } </style> </head> <body> <div id="container" class="container"> </ul> <?php if(isset($_POST['submit'])){ if(isset($_GET['go'])){ if(preg_match("/^[ a-zA-Z]+/", $_POST['search'])){ $name=$_POST['search']; //connect to the database $db=mysql_connect ("localhost", "MyDB", "pass") or die ('I cannot connect to the database because: ' . mysql_error()); //-select the database to use $mydb=mysql_select_db("eandagroup"); //-query the database table $sql="SELECT comp_name, jobtitle, job_description, location FROM jobs WHERE comp_name LIKE '%" . $name . "%' OR jobtitle LIKE '%" . $name ."%'"; //-run the query against the mysql query function $result=mysql_query($sql); ?> </div> </div> <?php if(!empty($result)) { ?> <div class="row space5"> <!-- row 3 begins --> <div class="col-md-12"> <table class="table table-striped"> <tr> <th style="width: 10%;">Firmenname</th> <th style="width: 10%;">Job Title</th> <th style="width: 30%;">Job Beschreibung</th> <th style="width: 10%;">Kanton</th> <?php foreach($result as $i => $value) { if(is_numeric($i)) { ?> <tr> <td><?php echo $result[$i]["comp_name"]; ?></td> <td><?php echo $result[$i]["jobtitle"]; ?></td> <td><?php echo nl2br($result[$i]["job_description"], "<br/>\n"); ?></td> <td><?php echo $result[$i]["location"]; ?></td> </tr> <?php } }//for close ?> </table> </div> </div> <?php if(!empty($userList["perpage"])) { ?> <div class="pagination center"><?php echo $userList["perpage"]; ?></div> <?php } ?> <?php }//if close ?> // at this line it generates an error I don't why!!! what's missing </body> </html>
  11. nicedad

    search a MySql table using PHP

    Hi Barand, thanks for the replay. unfortunately still giving me the result in one line or even any space. (akrambbbbakramccakramdddakrameeakrameeeeeeeakramtesteakramtesterakramtester)
  12. Hello everyone, I'm trying create search box to search a MySql DB table using one term regarding two columns in the table (jobtitle and location). (the table in the DB is similar to that of front-end in the attached image). I spent much time unfortunately I couldn't generate the desired results. the result however should be plotted as the original table with table-headers along with only records matched. I could do it but not as the same table in the image. thanx in advance, jobs.php <?php session_start(); require_once("common/DAO.php"); require_once("./common/config.php"); require_once("classes/class.jobs.php"); require_once("services/MemberService.php"); $objUser = new Jobs(); $location = ""; $Jqualify = ""; $userList = $objUser->getJobs($searchCondition); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Integrationsdienste</title> <link href="css/style.css" rel="stylesheet" type="text/css" /> <meta name="description" content=""> <meta name="author" content="templatemo"> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/templatemo_justified.css" rel="stylesheet"> <style> .btnjoin { padding: 5px 20px; border-radius: 4px; margin-bottom: 10px; color: #F0F8FF; background-color: #3CB6CB; border: none; cursor: pointer; } .table-striped>tbody>tr:nth-child(odd)>td, .table-striped>tbody>tr:nth-child(odd)>th { background-color: #DDDDDD; } .table-striped>tbody>tr:nth-child(odd)>th { background-color: #bbb; } .space5 { margin-top: 5px; } p.test { width: 27em; word-wrap: break-word; } </style> </head> <body> <div id="container" class="container"> </ul> <form method="post" action="search.php?go" id="searchform"> <div class="row space30"> <!-- row 2 begins --> <div class="col-md-12 text-center"> <label for="search">Search:</label> <input type="search" name="search" id="search"> <input type="submit" name="submit" value="Search"> </div> </div> <?php if(!empty($userList)) { ?> <div class="row space5"> <!-- row 3 begins --> <div class="col-md-12"> <table class="table table-striped"> <tr> <th style="width: 10%;">Firmenname</th> <th style="width: 10%;">Job Title</th> <th style="width: 30%;">Job Beschreibung</th> <th style="width: 10%;">Erfahrung</th> <th style="width: 10%;">Kanton</th> <th style="width: 10%;">Branche</th> <th style="width: 10%;">Vertragsart</th> <th style="width: 10%;">Gehalt/ Stunde</th></tr> <?php foreach($userList as $i => $value) { if(is_numeric($i)) { ?> <tr> <td><?php echo $userList[$i]["comp_name"]; ?></td> <td><?php echo $userList[$i]["jobtitle"]; ?></td> <td><?php echo nl2br($userList[$i]["job_description"], "<br/>\n"); ?></td> <td><?php echo $userList[$i]["minexp"]; ?> - <?php echo $userList[$i]["maxexp"]; ?></td> <td><?php echo $userList[$i]["location"]; ?></td> <td><?php echo $userList[$i]["Industry"]; ?></td> <td><?php echo $userList[$i]["JContract"]; ?></td> <td><?php echo $userList[$i]["minsal"]; ?> - <?php echo $userList[$i]["maxsal"]; ?></td> </tr> <?php } }//for close ?> </table> </div> </div> <?php if(!empty($userList["perpage"])) { ?> <div class="pagination center"><?php echo $userList["perpage"]; ?></div> <?php } ?> <?php }//if close ?> </form> </body> </html> search.php <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Integrationsdienste</title> <link href="css/style.css" rel="stylesheet" type="text/css" /> <meta name="description" content=""> <meta name="author" content="templatemo"> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/templatemo_justified.css" rel="stylesheet"> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="js/html5shiv.js"></script> <script src="js/respond.min.js"></script> <![endif]--> <style> .btnjoin { padding: 5px 20px; border-radius: 4px; margin-bottom: 10px; color: #F0F8FF; background-color: #3CB6CB; border: none; cursor: pointer; } .table-striped>tbody>tr:nth-child(odd)>td, .table-striped>tbody>tr:nth-child(odd)>th { background-color: #DDDDDD; } .table-striped>tbody>tr:nth-child(odd)>th { background-color: #bbb; } .space5 { margin-top: 5px; } p.test { width: 27em; word-wrap: break-word; } </style> </head> <body> <div id="container" class="container"> <?php if(isset($_POST['submit'])){ if(isset($_GET['go'])){ if(preg_match("/^[ a-zA-Z]+/", $_POST['name'])){ $name=$_POST['name']; //connect to the database $db=mysql_connect ("localhost", "MyDB", "pass") or die ('I cannot connect to the database because: ' . mysql_error()); //-select the database to use $mydb=mysql_select_db("eandagroup"); //-query the database table $sql="SELECT ID, comp_name, jobtitle FROM jobs WHERE comp_name LIKE '%" . $name . "%' OR jobtitle LIKE '%" . $name ."%'"; //-run the query against the mysql query function $result=mysql_query($sql); //-create while loop and loop through result set while($row=mysql_fetch_array($result)){ echo $CompName=$row['comp_name']; echo $JobTitle=$row['jobtitle']; echo $JobDest=$row[$i]["job_description"]; echo $Location=$row[$i]["location"]; echo $Inds=$row[$i]["Industry"]; echo $Contr=$row[$i]["JContract"]; } } else{ echo "<p>Please enter a search query</p>"; } } } ?> </table> </div> </div> <?php if(!empty($result["perpage"])) { ?> <div class="pagination center"><?php echo $result["perpage"]; ?></div> <?php } ?> <?php ?> </form> </div> </div> <!-- /container --> <!-- Bootstrap core JavaScript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> </ul> </body> </html>
  13. nicedad

    search a MySql table using PHP

    Hi QuickOldCar, thanx for your replay, you're right the Problem has to do with another file.
  14. Hello everyone, I'm trying to create a search drop down menu to search a Mysql table, unfortunately the search does work. even though it was working but I don't know what I did in wrong way. can anyone help and locate the mistake, please notice that there is not any error. it just does not retrieve any record from the DB. <?php session_start(); require_once("common/DAO.php"); require_once("./common/config.php"); require_once("classes/class.jobs.php"); require_once("services/MemberService.php"); $objUser = new Jobs(); $location = ""; $Jqualify = ""; $searchCondition = ""; if(!empty($_POST["search"])) { foreach($_POST["search"] as $k=>$v){ if(!empty($v)) { $queryCases = array("location","Jqualify"); if(in_array($k,$queryCases)) { } switch($k) { case "location": $location = $v; $searchCondition .= "where location LIKE '" . $v . "%'"; break; case "Jqualify": $Jqualify = $v; if(strlen($searchCondition)>1) $searchCondition .= "and Jqualify LIKE '" . $v . "%'"; else $searchCondition .= "where Jqualify LIKE '" . $v . "%'"; break; } } } } $userList = $objUser->getJobs($searchCondition); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Integrationsdienste</title> <link href="css/style.css" rel="stylesheet" type="text/css" /> <meta name="description" content=""> <meta name="author" content="templatemo"> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/templatemo_justified.css" rel="stylesheet"> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="js/html5shiv.js"></script> <script src="js/respond.min.js"></script> <![endif]--> <style> .btnjoin { padding: 5px 20px; border-radius: 4px; margin-bottom: 10px; color: #F0F8FF; background-color: #3CB6CB; border: none; cursor: pointer; } .table-striped>tbody>tr:nth-child(odd)>td, .table-striped>tbody>tr:nth-child(odd)>th { background-color: #DDDDDD; } .table-striped>tbody>tr:nth-child(odd)>th { background-color: #bbb; } .space5 { margin-top: 5px; } p.test { width: 27em; word-wrap: break-word; } </style> </head> <body> <div id="container" class="container"> <a href="http://www.templatemo.com/preview/templatemo_382_simplex" rel="nofollow"> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="468" height="60" <param name="movie" value="banner.swf"<param name="quality" value="high" /><param name="bgcolor" value="#ffffff"/> <embed src="banner.swf" quality="high" bgcolor="#ffffff" width="1140" height="300" name="banner" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> </embed></object> </a> <ul class="nav nav-justified"> <ul class="nav nav-justified"> <li class=""><a href="index.html">Home</a></li> <li><a href="about.html">Über Uns</a></li> <li><a href="services.html">Service</a></li> <li><a href="datenbank.php">Datenbank</a></li> <li><a href="jobs.html">Jobs</a></li> <li><a href="contact.html">Contact</a></li> </ul> <div class="row space30"> <!-- row 1 begins --> <div class="col-md-12"> <a href="login.php" class="btnjoin pull-right" style="padding:5px 29px;margin-right:10px;"> Login/ Anmelden</a> <a href="jobs.php" class="btnjoin pull-right">Jobs</a> <a href="datenbank.php" class="btnjoin pull-right">Bewerber</a> <?php if(!empty($userList["total_records"])) { ?> <div class="left"> <span style="color: #240CF7"><strong> <?php echo $userList["total_records"]; ?></strong></span> <span style="color: #0E3CEF; font-size: 14px;">Jobs verfügbar </span></div> <?php } ?> <form method="post"> <div class="row space30"> <!-- row 2 begins --> <div class="col-md-12 text-center"> <?php $userCity = $objUser->getJobByLocation(); ?> <select name="search[location]" style="min-width: 150px;padding: 3px;margin-right:25px;"> <option value="">Kanton auswählen</option> <?php if(!empty($userCity)) { foreach($userCity as $k=>$v) { ?> <option value="<?php echo $userCity[$k]["location"]; ?>" <?php if($userCity[$k]["location"] == $location) { echo "selected"; } ?>><?php echo $userCity[$k]["location"]; ?></option> <?php } } ?> </select> <?php $userOccupation = $objUser->getQualification(); ?> <select name="search[location]" style="min-width: 150px;padding: 3px;"> <option value="">Beruf auswählen</option> <?php if(!empty($userOccupation)) { foreach($userOccupation as $k=>$v) { ?> <option value="<?php echo $userOccupation[$k]["Jqualify"]; ?>" <?php if($userOccupation[$k]["Jqualify"] == $Jqualify) { echo "selected"; } ?>> <?php echo $userOccupation[$k]["Jqualify"]; ?></option> <?php } } ?> </select> <input type="submit" name="go" value="Search" style="border-color: none;border: 2px outset buttonface;padding: 2px 45px;margin-left: 20px;" > <input type="reset" value="Reset" style="border-color: none;border: 2px outset buttonface;padding: 2px 45px;margin-left: 10px;" onclick="window.location='jobs.php'"> </div> </div> <?php if(!empty($userList)) { ?> <div class="row space5"> <!-- row 3 begins --> <div class="col-md-12"> <table class="table table-striped"> <tr> <th style="width: 10%;">Firmenname</th> <th style="width: 10%;">Job Title</th> <th style="width: 30%;">Job Beschreibung</th> <th style="width: 10%;">Erfahrung</th> <th style="width: 10%;">Kanton</th> <th style="width: 10%;">Branche</th> <!--<th style="width: 10%;">Job Type</th>!--> <!--<th style="width: 10%;">Qualifikation</th>!--> <th style="width: 10%;">Vertragsart</th> <th style="width: 10%;">Gehalt/ Stunde</th></tr> <?php foreach($userList as $i => $value) { if(is_numeric($i)) { ?> <tr> <td><?php echo $userList[$i]["comp_name"]; ?></td> <td><?php echo $userList[$i]["jobtitle"]; ?></td> <!--<?php echo $userList[$i]["job_description"];?></td>!--> <td><?php echo nl2br($userList[$i]["job_description"], "<br/>\n"); ?></td> <td><?php echo $userList[$i]["minexp"]; ?> - <?php echo $userList[$i]["maxexp"]; ?></td> <td><?php echo $userList[$i]["location"]; ?></td> <td><?php echo $userList[$i]["Jqualify"]; ?></td> <td><?php echo $userList[$i]["JContract"]; ?></td> <!--<td><?php echo $userList[$i]["Jtype"]; ?></td>!--> <!--<td><?php echo $userList[$i]["Jqualify"]; ?></td>!--> <td><?php echo $userList[$i]["minsal"]; ?> - <?php echo $userList[$i]["maxsal"]; ?></td> </tr> <?php } }//for close ?> </table> </div> </div> <?php if(!empty($userList["perpage"])) { ?> <div class="pagination center"><?php echo $userList["perpage"]; ?></div> <?php } ?> <?php }//if close ?> </form> <!-- Site footer --> <div class="footer"> <p><center>© Copyright 2015 | Ausländer und Integrations Dienste | <a rel="nofollow" href="http://www.a-Integrationsdienste.ch">www.a-Integrationsdienste.ch</a></center> </div> </div> <!-- /container --> <!-- Bootstrap core JavaScript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> </ul> </body> </html>
  15. nicedad

    How to creat a line break in a look

    Hi guys, problem solved, thanks a lot for all of you, as your adds were very helpful. Valando was right because my test text hadn't any break therefore was taken as one word. again thanks so much
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.