Jump to content

justinjkiss

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

justinjkiss's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks a ton... i feel stupid for that miss
  2. OK below is my code. the values for $row['state'] are in this format "AL - Alabama" its got the space in it. while($row = mysql_fetch_array($result)) { echo "<option value=" . $row['state'] . '">' . $row['state']; } ?> When i run the script it outputs HTML as this <option value="AL" -="" alabama"="">AL - Alabama</option> As you can see at the space it terminates and puts the " in. Im assuming this is a rookie programming mistake. Please help, Justin
  3. AND figured it out (select distinct) thanks for you help!!!!
  4. UPDATE: The AJAX works yay... i suppose i should change this topic to solved because the AJAX is solved. I still got the issue of deduplicating the php results. Any assistance here or should i make a php forum post.
  5. POST changed to get and i got my values. YAY... now to strip the results so i dont have excessive repeating. Think i can pull this one off unless anybody has a quick fix there too. http://hybridlifts.com/position/pages/ss/parts2.php I got some tweaking to do now... seems the functional unit get populated but when i run my php post action im not passing a value .... i think i might have it though THANKS SO much for pointing out my typo!!!!
  6. wow i just stared at that for a few minutes... cant believe i had a typo there... problem 1 solved now the php isnt reading the values right... ugg time to look for typos again..
  7. AJAX <script> function getXMLHTTP() { //fuction to return the xml http object var xmlhttp=false; try{ xmlhttp=new XMLHttpRequest(); } catch(e) { try{ xmlhttp= new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e1){ xmlhttp=false; } } } return xmlhttp; } function getfunit(modelId,locationId) { var strURL="getfunit.php?model="+document.fparts.model.vaule+"&location="+document.fparts.location.value; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('funitdiv').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("POST", strURL, true); req.send(null); } } </script> form code <form name="fparts" action="<?=$_SERVER['PHP_SELF']?>" method="post"> <label></label> <select name="model"> <option value="default" selected="selected">Please Select Machine</option> <option value="HB-P830">HB-P830</option> <option value="HB-830">HB-830</option> <option value="HB1030S1">HB-1030 Series 1</option> <option value="HB1030S2">HB-1030 Series 2</option> <option value="HB1430S1">HB-1430 Series 1</option> <option value="HB1430S2">HB-1430 Series 2</option> <option value=""></option> <option value="HB-P830CE">HB-P830CE</option> <option value="HB-830CE">HB-830CE</option> <option value="HB1030CES1">HB-1030CE Series 1</option> <option value="HB1030CES2">HB-1030CE Series 2</option> <option value="HB1430CES1">HB-1430CE Series 1</option> <option value="HB1430CES2">HB-1430CE Series 2</option> </select> <label></label> <select name="location" onChange="getfunit()"> <option value="default" selected="selected">Please Select Part Location</option> <option value="Base">Base</option> <option value="Decals">Decals</option> <option value="Lower Control">Lower Control</option> <option value="Misc">Misc</option> <option value="Railing">Railings</option> <option value="Scissors">Scissors</option> <option value="Upper Control">Upper Control</option> </select> <label></label> <div id="funitdiv"><select name="funit"> <option>Please Select Functional Circuit</option> </select></div> <label></label> <input type="submit" name="submit" value="Submit" id="submit"> </form> php processing code <? $modelId=$_POST['model']; $locationId=$_POST['location']; $link = mysql_connect('localhost', 'custkis6_dealers', 'locate'); //changet the configuration in required if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db('custkis6_parts'); $query="SELECT fcircuit FROM hybrid WHERE model='$modelId' AND plocation='$locationId'"; $result=mysql_query($query); ?> <select name="funit"> <option>Select Functional Circuit</option> <option><? echo $modelId ?></option> <option><? echo $locationId ?></option> <? while($row=mysql_fetch_array($result)) { ?> <option value><?=$row['fcircuit']?></option> <? } ?> </select> This is a sample request and im getting undefined under model yet but the location is coming out right. Request URL:http://hybridlifts.com/position/pages/ss/getfunit.php?model=undefined&location=Base Request Method:POST Status Code:200 OK
  8. Does anybody have a chunk of code i could use? Im struggling finding something to pass 2 values from 2 select boxes to a php form and return a result. Sounds so easy but i cant make it work and im a noob at javascript/ajax. I have got it to send one of the 2 values but the other value that gets sent is undefined. Thanks, Justin
  9. To start - i know there are script out there for this but i cant get any to work for whatever reason. Im attempting to use Roshan's Ajax dropdown code with php (http://hybridlifts.com/position/pages/ss/parts1.php) and i can get it to pass the value of the 1st dropdown to the php file and it then populates the 2nd dropdown. The 2nd dropdown isnt stripping duplicates out though so its over populated. Also when i make my selection on the 2nd one i get an error on the dev console in chrome which says "parts2.php:1 Uncaught ReferenceError: HB is not defined." Under the network and if i inspect the element the value being passed is actually HB-830 but chrome is seeing only HB. The 3rd dropdown wont populate with the error. The contents of dropdown1 (models) and dropdown2 (location) are the fixed and wont change. Depending on the model the functional circuit might have content or might not... I only want the functional ciruits that have data in the database to be options for selection. An example of what im talking about is my non AJAX version here - http://hybridlifts.com/position/pages/ss/parts.php - select hb-830 -> decals -> special kits. This spits out saying no parts contact service. Why bother even giving the option to select something that doesnt exist was my thought. parts2.php <!DOCTYPE HTML> <html><!-- InstanceBegin template="/Templates/indextemplate.dwt" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!-- InstanceBeginEditable name="doctitle" --> <title>Parts</title> <!-- InstanceEndEditable --> <link href="../../css/main.css" rel="stylesheet" type="text/css"> <link href='http://fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'> <!-- InstanceBeginEditable name="head" --> <script language="javascript" type="text/javascript"> // Roshan's Ajax dropdown code with php // This notice must stay intact for legal use // Copyright reserved to Roshan Bhattarai - nepaliboy007@yahoo.com // If you have any problem contact me at http://roshanbh.com.np function getXMLHTTP() { //fuction to return the xml http object var xmlhttp=false; try{ xmlhttp=new XMLHttpRequest(); } catch(e) { try{ xmlhttp= new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e1){ xmlhttp=false; } } } return xmlhttp; } function getloc(modelId) { var strURL="getlocation.php?model="+modelId; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('statediv').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } function getfunit(modelId,locationId) { var strURL="getfunit.php?model="+modelId+"&location="+locationId; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('citydiv').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } </script> <!-- InstanceEndEditable --> </head> <body> <div id="container"> <div id="container_inner"> <div id="header"> <img src="../../images/hybridlogo.png" alt="Hy-Brid Lifts" id="logo" /> </div> <div id="nav"> <ul id="menu"> <li> <a href="../../index.html">Home</a> </li> <li> <a href="../about.html">About</a> <ul> <li> <a href="../about/mvc.html">Mission, Vision, Core Values</a> </li> <li> <a href="../about/history.html">History</a> </li> <li> <a href="../about/news/">News</a> </li> </ul> </li> <li> <a href="../products.html">Products</a> <ul> <li><a href="#">ANSI/CSA</a> <ul> <li> <a href="../products/hbp830.html">HB-P830</a> </li> <li> <a href="../products/hb830.html">HB-830</a> </li> <li> <a href="../products/hb1030.html">HB-1030</a> </li> <li> <a href="../products/hb1430.html">HB-1430</a> </li> </ul> </li> <li><a href="#">CE</a> <ul> <li> <a href="../products/hbp830ce.html">HB-P830CE</a> </li> <li> <a href="../products/hb830ce.html">HB-830CE</a> </li> <li> <a href="../products/hb1030ce.html">HB-1030CE</a> </li> <li> <a href="../products/hb1430ce.html">HB-1430CE</a> </li> </ul> </li> </ul> </li> <li> <a href="../servicesupport.html">Service and Support</a> <ul> <li> <a href="training.html">Training</a> </li> <li> <a href="parts.php">Parts</a> </li> <li> <a href="servicerepair.html">Service and Repair</a> </li> <li> <a href="warranty.html">Warranty</a> </li> </ul> </li> <li><a href="#">Dealer Locator</a> <ul> <li> <a href="../locator/locateaf.php">Africa</a> </li> <li> <a href="../locator/locateas.php">Asia</a> </li> <li> <a href="../locator/locateauoc.php">Australia/Oceania</a> </li> <li> <a href="../locator/locateeu.php">Europe</a> </li> <li> <a href="../locator/locatena.php">North America</a> </li> <li> <a href="../locator/locatesa.php">South America</a> </li> </ul> </li> <li> <a href="../dealercenter.php">Dealer Center</a> <ul> <li> <a href="../dealercenter.php">Dealer Home</a> </li> <li> <a href="../dealer/dparts.php">Parts</a> </li> <li> <a href="../dealer/dwarranty.php">Warranty</a> </li> <li> <a href="../dealer/dsales.php">Sales</a> </li> <li> <a href="../dealer/dmm.php">Marketing Materials</a> </li> </ul> </li> <li> <a href="../contact.html">Contact Us</a> </li> </ul> <!-- InstanceBeginEditable name="EditRegion6" --> <div id="breadcrumb"> <ul id="crumbs"> <li><a href="../../index.html">Home</a></li> <li><a href="../servicesupport.html">Service and Support</a></li> <li>Parts</li> </ul> </div> <!-- InstanceEndEditable --> </div> <div id="flashbar"> <!-- InstanceBeginEditable name="EditRegion5" --> <!-- InstanceEndEditable --> </div> <div id="content"> <div id="boxcontainer"> <!-- InstanceBeginEditable name="content" --> <!-- InstanceEndEditable --> </div> </div> <div id="news"> <!-- InstanceBeginEditable name="news" --> <div id="box"> <div class="boxheader"><p class="boxhead">Parts Selector</p></div> <div id="tabscontent"> <div id="formsmall"> <form action="<?=$_SERVER['PHP_SELF']?>" method="post"> <label></label> <select name="model" onChange="getloc(this.value)"> <option value="default" selected="selected">Please Select Machine</option> <option value="HB-P830">HB-P830</option> <option value="HB-830">HB-830</option> <option value="HB1030S1">HB-1030 Series 1</option> <option value="HB1030S2">HB-1030 Series 2</option> <option value="HB1430S1">HB-1430 Series 1</option> <option value="HB1430S2">HB-1430 Series 2</option> <option value=""></option> <option value="HB-P830CE">HB-P830CE</option> <option value="HB-830CE">HB-830CE</option> <option value="HB1030CES1">HB-1030CE Series 1</option> <option value="HB1030CES2">HB-1030CE Series 2</option> <option value="HB1430CES1">HB-1430CE Series 1</option> <option value="HB1430CES2">HB-1430CE Series 2</option> </select> <label></label> <div id="statediv"><select name="state" > <option>Select Country First</option> </select></div> <label></label> <div id="citydiv"><select name="city"> <option>Select State First</option> </select></div> <label></label> <input type="submit" name="submit" value="Submit" id="submit"> </form> </div> <? if(isset($_POST['submit'])) { // open connection to MySQL server $connection = mysql_connect('localhost', $username , $password) or die ('Unable to connect!'); // select database for use mysql_select_db('custkis6_parts') or die ('Unable to select database!'); $model=$_POST['model']; $location=$_POST['location']; $funit=$_POST['functionalunit']; $query = "SELECT * FROM hybrid WHERE model='$model' AND plocation='$location' AND fcircuit='$funit'"; $result = mysql_query($query) or die ('Error in query: $query. ' . mysql_error()); echo '<table id="producttable"><thead><tr><th><p>Model: ' . $model . '</p></th><th><p>Part Location: '. $location . '</p></th><th><p>Functional Unit: ' . $funit . '</p></th></tr></thead><tbody>'; // check if records were returned if (mysql_num_rows($result) > 0) { // print HTML table echo '<table id="producttable" class="sortable"><thead><tr><th><h3>Part</h3></th><th><h3>Part Number</h3></th><th class="nosort"><h3>Part Image</h3></th><th class="nosort"><h3>Part Notes</h3></th></tr></thead><tbody>'; // iterate over record set // print each field while($row = mysql_fetch_row($result)) { echo '<tr>'; echo '<td>' . $row[3] . '</td>'; echo '<td>' . $row[2] . '</td>'; echo '<td>a href="http://' . $row[5] . '"target="_blank">img src="http://' . $row[4] . '" /></a></td>'; echo '<td>' . $row[8] . '</td>'; echo '</tr>'; } } else { // print error message echo '<table id="producttable"><tr>'; echo '<td class="textcenter">No Parts found.<br />Please contact the Service Department at +1-262-644-1300</td>'; echo '</tr>'; } // once processing is complete // free result set mysql_free_result($result); // close connection to MySQL server mysql_close($connection); } else { } ?> </tbody> </table> <script type="text/javascript" src="../../files/tinytable/packed.js"></script> <script type="text/javascript"> var sorter = new TINY.table.sorter("sorter"); sorter.head = "head"; sorter.asc = "asc"; sorter.desc = "desc"; sorter.even = "evenrow"; sorter.odd = "oddrow"; sorter.evensel = "evenselected"; sorter.oddsel = "oddselected"; sorter.paginate = false; sorter.currentid = "currentpage"; sorter.limitid = "pagelimit"; sorter.init("producttable",1); </script> </div> </div> <!-- InstanceEndEditable --> </div> <div id="footer"> <div id="copyright"> <p>Copyright © 2011 Custom Equipment, Inc | <a href="../../sitemap.html">Sitemap</a></p> </div> <div id="social"> <p class="textcenter"><a href="http://www.facebook.com/hybridlifts" target="_blank"><img src="../../images/fb20px.png" alt="Hy-Brid Facebook Page" /></a> <a href="http://www.youtube.com/user/HyBridLifts" target="_blank"><img src="../../images/youtube20px.png" alt="Hy-Brid YouTube Page" /></a> <g:plusone count="false"></g:plusone><script type="text/javascript"> (function() {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);})();</script></p> </div> </div> </div> </div> </body> <!-- InstanceEnd --></html> getlocation.php <? $model=$_GET['model']; $link = mysql_connect('localhost', 'custkis6_dealers', 'locate'); //changet the configuration in required if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db('custkis6_parts'); $query="SELECT plocation FROM hybrid WHERE model='$model'"; $result=mysql_query($query); ?> <select name="location" onchange="getfunit(<?=$model?>,this.value)"> <option>Select Machine Location</option> <? while($row=mysql_fetch_array($result)) { ?> <option value=<?=$row['plocation']?>><?=$row['plocation']?></option> <? } ?> </select> getfunit.php <? $modelId=$_GET['model']; $locationId=$_GET['location']; $link = mysql_connect('localhost', 'custkis6_dealers', 'locate'); //changet the configuration in required if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db('custkis6_parts'); $query="SELECT fcircuit FROM hybrid WHERE model='$modelId' AND plocation='$locationId'"; $result=mysql_query($query); ?> <select name="funit"> <option>Select Functional Circuit</option> <? while($row=mysql_fetch_array($result)) { ?> <option value><?=$row['fcircuit']?></option> <? } ?> </select>
  10. 1. use php to display the image - prevent source code access 2. take a transparant gif and layer over the top - on right click save they get a blank image saved 3. use javascript to prevent print screen - helps for some 4. Watermark the image in the most obtrusive way before sale then include a less obtrusive date its valid to 5. Make seal complex. Use gradients, a lot harder to manipulate in photoshop when removing valid date Of course the items listed are just someways to block MOST people. There is no perfect way to protect current image files. Best would be copyright but then you still got to find it being used illegally. That would scare some away from trying to fake it. All we can do is hope that a new image format will come out that you can imbed valid checks and site checks. Would help photographers if the machines would read a code like that and go invalid print file. But that will be years before we see anything.
  11. putting the or die causes a problem like i thought it would. The connection to the database is from the include but the include also keeps the connection open until logout is hit because it is a protected section with a login. would i be better just putting this into a separate php file and have the form process it instead. Then just use a separate login and so i can close the connection each time.
  12. as long as the images are fixed in size it wouldnt be hard to create a table to do 3 per row it would be as simple as // print HTML table echo '<tr>'; echo '<td>whatever text if any</td>'; echo '</tr>'; // iterate over record set // print each field while($row = mysql_fetch_row($result)) { echo '<tr>'; echo '<td></td>'; echo '<td></td>'; echo '<td></td>'; echo '</tr>'; } } else { // print error message echo '<tr>'; echo '<td>No pics found</td>'; echo '</tr>'; } // once processing is complete // free result set mysql_free_result($result); // close connection to MySQL server mysql_close($connection); then just use your code. Im new at php but would image that would work. I get mysql data and insert it into columns then start a new row. Might have to use some count variable. Dont know what your code is. If you dont have a standard size picture use the code from the previous post to resize then insert into a 3 column loop like i showed
  13. no errors are popping up when i hit submit on the form. user has all rights. I rechecked and tried again but still nothing. When i enter killer as the user i get this when i echo $sql CREATE TABLE `custkis6_login` `killer` ( `model` varchar( 10 ) NOT NULL , `serial` int( 10 ) NOT NULL , `servdate` varchar( 10 ) NOT NULL , `faildate` varchar( 10 ) NOT NULL , `repairdate` varchar( 10 ) NOT NULL , `comment` longtext NOT NULL , `traveltime` mediumint( 3 ) NOT NULL , `repairtime` mediumint( 3 ) NOT NULL , `claimhours` mediumint( 3 ) NOT NULL , `hourrate` varchar( 3 ) NOT NULL , `claimname` varchar( 50 ) NOT NULL , PRIMARY KEY ( `serial` ) ) ENGINE = MyISAM DEFAULT CHARSET = latin1;[...]
×
×
  • Create New...

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.