Jump to content

texmansru47

Members
  • Posts

    47
  • Joined

  • Last visited

    Never

About texmansru47

  • Birthday 12/23/1965

Profile Information

  • Gender
    Male
  • Location
    Fort Worth, TX

Contact Methods

  • Yahoo
    texmansru47

texmansru47's Achievements

Member

Member (2/5)

0

Reputation

  1. diocyria, I think a need a more detailed example. the form I have is being generated from a table search. //if ($Prod <> 0) { $sql = "SELECT * FROM `OpenBooks` WHERE `bookgrp`= '$group'"; $results = mysql_query($sql); if ($results) { //this will check if the query failed or not if (mysql_num_rows($results) > 0) { //this will check if results were returned while($copy = mysql_fetch_array($results)) { $variable1=$copy['booknum']; $variable2=$copy['bookgrp']; $variable3=$copy['booktitle']; //table layout for results print ("<tr>"); print ("<td><center>$variable1</center></td>"); print ("<td><center>$variable2</center></td>"); print ("<td><left>$variable3</left></td>"); print ("</tr>"); } } else { echo "No results returned"; } } else { echo "Query error: ".mysql_error(); } mysql_close($con); ?> Any ideas how to implement a selection check box in this format?
  2. diocyria - I do beleive that is what I desire. I just need some way to have the user select a value that was generated from a pre-existing table and from that the selected data can be used for adding to another table. On the example code would that create a checkbox that could be added in a IF THEN Loop?
  3. Ok... This is sounding like not the route to go. How about this... Make the list generated from the table be HTML where the user can select and then from there I can create code to do the manipulation of the data from there? I have read somewhere that you can list the data with HTML links... but I need to research that. Cheers,
  4. Hey everyone. I am creating a website so my family can select from the list of present my daugther has asked for. I have them logging in, and that works. I have the table data set and the search and table display works. But I would like to display the list (as in the code below) but with a checkbox in the first column (add a column). From that the authenticated user can click on the item they have purchased and that selection will be moved to another table (called purchased). I have that code. The only thing I cannot figure out is to present the data in list form with a checkbox (like you would see on an order form). Here is the display code (there is no error checking at this point): <head><LINK REL="SHORTCUT ICON" HREF="cmwschl.ico"></head> <body bgcolor="#C0C0C0"> <font face="Arial" color="#000080">Books from the Selected Series</font> </h1> <hr font color="Navy" font size="3"> <center> <table border="1" cellpadding="5" cellspacing="0" bordercolor="#000000"> <tr> <td width="170" bgcolor="#FFCC66"><center><b><font color="navy" size="2" face="Trebuchet MS"><b><center>Book Number</center></font></b></center></td> <td width="140" bgcolor="#FFCC66"><center><b><font color="navy" size="2" face="Trebuchet MS"><b><center>Book Group</center></font></b></center></td> <td width="100" bgcolor="#FFCC66"><center><b><font color="navy" size="2" face="Trebuchet MS"><b><center>Book Title</center></font></b></center></td> </tr> <?php $con = mysql_connect("localhost","twilson","R00tb33r!") or die('Connection: ' . mysql_error());; mysql_select_db("CMWWeb", $con) or die('Database: ' . mysql_error()); ?> <? $group = $_POST['bookgrp']; //if ($Prod <> 0) { $sql = "SELECT * FROM `OpenBooks` WHERE `bookgrp`= '$group'"; $results = mysql_query($sql); if ($results) { //this will check if the query failed or not if (mysql_num_rows($results) > 0) { //this will check if results were returned while($copy = mysql_fetch_array($results)) { $variable1=$copy['booknum']; $variable2=$copy['bookgrp']; $variable3=$copy['booktitle']; //table layout for results print ("<tr>"); print ("<td><center>$variable1</center></td>"); print ("<td><center>$variable2</center></td>"); print ("<td><left>$variable3</left></td>"); print ("</tr>"); } } else { echo "No results returned"; } } else { echo "Query error: ".mysql_error(); } mysql_close($con); ?> </table> </center>
  5. if so, I still do not get a file prompt to save a file. I get nothing.
  6. You mean the following: $_fp = @fopen( $_file, 'w' ); // should be $_fp = fopen( $_file, 'w' ); @fwrite( $_fp, $_csv_data ); // should be fwrite( $_fp, $_csv_data ); @fclose( $_fp ); // should be fclose( $_fp ); Would that be correct?
  7. All, I have been struggling to create a very simple CSV file (a physical file) from php. I have tried several variations, but here is what I have currently: <?php ini_set('display_errors', 1); error_reporting(E_ALL); $newline = "<br />"; $space =" "; if (isset($_GET['param1']) && !empty($_GET['param1'])){ $BatchNumData=$_GET['param1']; echo "The Batch Number is:\n$BatchNumData and the Shipment is listed as Good.".$newline.$newline; } elseif ($_SERVER['REQUEST_METHOD'] == 'POST'){ $BatchNumData=$_POST['param1']; echo "The Batch Number is:\n$BatchNumData".$newline.$newline; // Connect to mysql database $con = mysql_connect("localhost","user","XXXXXX") or die('Connection: ' . mysql_error());; mysql_select_db("datatest", $con) or die('Database: ' . mysql_error()); //************************************************************ //** Create CSV file for Labeling MP ** //************************************************************ $mosConfig_locale_debug = 0; $mosConfig_locale_use_gettext = 0; $mpit=$_POST['MPID']; $sql = "SELECT * FROM `ShipTemp` WHERE `BatchNum` = '$BatchNumData' AND `MPBoxNum` = '$mpit'"; $results = mysql_query($sql); $sernumi=$results['serNum']; $model=$results['OEMSku']; $masterid=$results['MPBoxNum']; $_file = 'optlbl1.csv'; $_fp = @fopen( $_file, 'w' ); while (list($sernum,$model,$masterid)=mysql_fetch_row($results)) { $_csv_data=$imei.','.$model.','.$masterid. "\n"; @fwrite( $_fp, $_csv_data ); } @fclose( $_fp ); mysql_close($con); } ?> and I get NOTHING for output. I know I'm missing something, but what? There are NO GOOD tutorials out there and please do not suggest php.net, since I have been all over that and nothing there is clear enough to figure out the root cause of why my codes are not working. Any ideas?
  8. I need the ability to package 36 units into one box... each unit will be tracked by that boxID. For example: If I have product in a table with serial numbers 1 thru 36 let's say, and they all go in one box... and that box ID is 3500... how can I: 1) capture that data in the table where the Product ID and the BOX ID are listed 2) only increment the box number to the next number (incremental) when the box is either: A) reached the limit available which is 36 units. B) the user can terminate the packaging BEFORE 36 if there is not enough items to go into the box? c) Need to have the BOX ID auto generated? Honestly I have tried a one thing to no avail. I have tried: $query = "SELECT MAX(`MPBoxNum`) AS `max` FROM `Ship`"; $findings = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($findings); $startit = $row['max']; // I get a incremental value for each item under box ID (1, then 2, etc). I could have the user insert the BOX ID when they are shipping, but that would be REAL time consuming and a real pain since they would have to know all last BOX ID or run a query to find it. Any ideas?
  9. Well I thought I had the proper logic (and I may) but I cannot see to figure out why it is not working: Scenario: I have a form that has php code behind it. When the user enters in the data there is a check that has to be made: 1) has the product been processed as "ALL GOOD" (that is where the product is ok, and was passed to shipping) 2) If the product was not ALL GOOD did it PASSED, if so enter a particular type of data for that record in the production and history tables. 3) if the product was not ALL GOOD and it FAILED, if so enter a particular amount of data in the production and history tables (see code below) The problem is if I flag data that is in the database as "All GOOD" the proper response occurs (I get the error message from the isset() statement being positive) but if the product I enter in is either PASSED or FAILED, nothing happens. I thought using a IF ELSEIF statement would be the proper validation point but either it is not or my INSERT code is all wrong. I have tried the INSERT code for the PASSED portion without any IF ELSE or IF ELSEIF statement and it wrote the proper date to the table, so I think it is correct. I'm just not sure why it is not working. Here is the code: <?php if (isset($_GET['param1']) && !empty($_GET['param1'])){ $prod=$_GET['param1']; echo "Your Prod Number is:\n$prod"; } elseif ($_SERVER['REQUEST_METHOD'] == 'POST'){ $imei=$_POST['param1']; echo "Your Bloody prod Number is:\n$prod"; // Main PHP code for connecting to the database for production processing $con = mysql_connect("localhost","user","xxxxxx") or die('Connection: ' . mysql_error());; mysql_select_db("logdata", $con) or die('Database: ' . mysql_error()); //Initial search and selection. $grabit = "SELECT * FROM `recv` WHERE `ProdNum` = '$prod'"; $testdata = mysql_query($grabit) or die(mysql_error()); $testit = mysql_fetch_assoc($testdata) or die(mysql_error()); //SQL query for is the Prod Number was completed fine, this will populate the PROD table accordingly. // variables for this section only! $ota =$_POST['TestResults']; $notes=$_POST['undernotes']; // variables from the SELECT Query $batch=$testit['BatchNum']; $sku=$testit['ModelSku']; $type=$testit['ModelType']; $serial=$testit['SerNum']; $card=$testit['CardType']; //Run the Select Query to gather the proper FailCode response from Table FailCode (Lookup Table) to populate the Prod/ProdHist Tables. $failcode = "SELECT * FROM `FailCode` WHERE `CodeID` = '$codeid'"; $faildata = mysql_query($failcode) or die(mysql_error()); $failrun = mysql_fetch_assoc($faildata) or die(mysql_error()); //Set variable from Fail Code SELECT process. $failit=$failrun['FailCode']; $failnotes=$_POST['FailNotes']; //Search the Prod Database for duplicates $findit = "SELECT * FROM `Prod` WHERE `ProdNum` = '$prod'"; $finddata = mysql_query($findit) or die(mysql_error()); $dataresults = mysql_fetch_assoc($finddata) or die(mysql_error()); // variables from the verification of AllGOOD Query $done=$dataresults['PassGood']; // Test loop of the data inputted to verify the data inputted into the table. if (isset($done) == 'Yes') { ?> <head> <script language="JavaScript"> alert("This Unit has been passed as ALL GOOD. Please forward to Kitting."); </script> </head> <?php } elseif ($ota == 'Passed'){ // INSERT Data into Prod Table. @mysql_query("INSERT INTO `Prod` (`BatchNum`,`ProdNum`,`SerNum`,`ModelSku`,`ModelType`,`CardType`,`TestResults`,`undernotes`,`DateRep`) VALUES ('$batch', '$prod','$serial','$sku','$type','$card','$ota','$notes', Now())") or die(mysql_error()); @mysql_query("DELETE FROM `Prod` WHERE `ProdNum` = 0"); //Insert this record into the SnaProd Database for historical purposes. mysql_query("INSERT INTO `ProdHist` SELECT * FROM `Prod` WHERE `IMEINum` = '$prod'") or die(mysql_error()); //Notifies the User that the record was successfully inputted into the Prod Table. print "<p>This record was updated in the History Table.</p>"; } else { // INSERT Data into Prod Table. @mysql_query("INSERT INTO `Prod` (`BatchNum`,`ProdNum`,`SerNum`,`ModelSku`,`ModelType`,`CardType`,`TestResults`,`undernotes`,`DateRep`) VALUES ('$batch', '$prod','$serial','$sku','$type','$card','$ota','$notes', Now())") or die(mysql_error()); @mysql_query("DELETE FROM `Prod` WHERE `ProdNum` = 0"); //Insert this record into the Prod Database for historical purposes. mysql_query("INSERT INTO `ProdHist` SELECT * FROM `Prod` WHERE `ProdNum` = '$prod'") or die(mysql_error()); //Notifies the User that the record was successfully inputted into the Prod Table. print "<p>This record was recorded as a FAILURE in the History Table.</p>"; mysql_close($con); } ?> The form is here: <!-- This section will create the form for the "Repair" Unit popup window. --> <form method="post" name="prod" action="repair.php"><font color="#000080" face="Arial"> <input type="hidden" name="param1" value="<?php echo $imei; ?>" /> <p><u><b><font size="2" font color="maroon" font type="Tahoma">Repair Section:</font></b></u></p> <p><font face="Arial" font size="2"> <b>OTA Pass/Fail: <select name="TestResults" size="1" name="TestResults"> <option value="NULL">--</option> <option value="Passed">Passed</option> <option value="Failed">Failed</option> </select></b></font> <font face="Arial" font size="2"><br> <b>Fail Code(If Failed): <select name="CodeID" size="1" name="CodeID"> <option value="0">No Fail</option> <option value="1">No Power</option> <option value="2">Not Recognized</option> <option value="3">No Connection</option> <option value="4">Unable to Boot</option> <option value="5">WLAN Fail</option> </select></b></font> <font face="Arial" font size="2"><br> <td <font color="Navy" size="3" face="Tahoma"><b>Fail (Other): </b></font></td> <td><input name="FailNotes" type="text" id="FailNotes" size="35"><br> <td <font color="Black" size="2" face="Tahoma">Notes: </font></td> <td><input name="undernotes" type="text" id="undernotes" size="35"> <p align="center"> <!-- <input type="submit" value="Repair Data Submit" name="submit"></p> --> <input type="submit" value="Repair Data Submit" name="submit" onclick="refresh_page();window.close()"></p> </td> </body> </form> <form method="post"> <input type="button" value="Close Window" onclick="window.close()"> </form> To recap: I get the proper response if the input is in the database is marked as ALL GOOD, but I cannot write data if the unit is not ALL GOOD and PASSED or FAILED. Any ideas?
  10. Well I got the error message to work the problem is I had to take on the following command to see it: <input type="submit" value="Repair Data Submit" name="submit" onclick="window.close()"></p> Is there a way to have the error message pop up when the submit button is click, but also shutdown window as well... like a time delay or something? Here the code again: <?php if (isset($_GET['param1']) && !empty($_GET['param1'])){ $imei=$_GET['param1']; echo "Your Prod Number is:\n$prod"; } elseif ($_SERVER['REQUEST_METHOD'] == 'POST'){ $imei=$_POST['param1']; // echo "Your Bloody Prod Number is:\n$prod"; // Main PHP code for connecting to the database for production processing $con = mysql_connect("localhost","user","xxxxxxx") or die('Connection: ' . mysql_error());; mysql_select_db("logdata", $con) or die('Database: ' . mysql_error()); //Initial search and selection. $grabit = "SELECT * FROM `Prod` WHERE `ProdNum` = '$prod"; $testdata = mysql_query($grabit) or die(mysql_error()); $testit = mysql_fetch_assoc($testdata) or die(mysql_error()); //SQL query for is the Prod Num was completed fine, this will populate the PROD table accordingly. // This query is to generate values for validation. echo "\nThere is a Completed Transaction for this Record in this table."; // variables from the SELECT Query $done=$testit['PassGood']; $batch=$testit['BatchNum']; $sku=$testit['ModelSku']; $type=$testit['ModelType']; $rts=$testit['RTSNum']; $card=$testit['CardType']; $notes=$_POST['undernotes']; // variables for this section only! $qc =$_POST['qcstatus']; $Diag = 'Passed'; $ota =$_POST['TestResults']; // Test loop of the data inputted to verify the data inputted into the table. if (isset($done)) { ?> <head> <script language="JavaScript"> alert("This Unit has been passed as ALL GOOD. Please forward to Kitting."); </script> </head> <?php } else { mysql_query("INSERT INTO `Prod` (`BatchNum`,`ProdNum`,`ModelNum`,`Diagnostic`,`ModelSku`,`ModelType`,`CardType`,`TestResults`,`undernotes`,`DateRep`) VALUES ('$batch', '$prod','$modnum','$Diag','$sku','$type','$card','$ota','$notes', Now())") or die(mysql_error()); @mysql_query("DELETE FROM `Prod` WHERE `ProdNum` = 0"); mysql_query("INSERT INTO `ProdHist` SELECT * FROM `Prod` WHERE `IMEINum` = '$prod'") or die(mysql_error()); // Notify the User that the record is being copied to the ProdHist Table. print "<p>This record was updated in the History Table.</p>"; mysql_close($con); } } ?> <body> <P> <!-- This section will create the form for the "Repair" Unit popup window. --> <form method="post" name="prod" action="repair.php"><font color="#000080" face="Arial"> <input type="hidden" name="param1" value="<?php echo $prod; ?>" /> <p><u><b><font size="2" font color="maroon" font type="Tahoma">Under 30 Repair OTA Section:</font></b></u></p> <p><font face="Arial" font size="2"> <b>OTA Pass/Fail: <select name="TestResults" size="1" name="TestResults"> <option value="NULL">--</option> <option value="Passed">Passed</option> <option value="Failed">Failed</option> </select></b></font> <font face="Arial" font size="2"> <td <font color="Navy" size="3" face="Tahoma"><b><u>Notes:</u> </b></font></td> <td><input name="undernotes" type="text" id="undernotes" size="35"> <p align="center"> <input type="submit" value="Repair Data Submit" name="submit"></p> </td> </body> </form> I desire the popup form to be closed when the user clicks submit, but the error message to popup even if the form is closed... OR Have the error message popup when the SUBMIT button is clicked and when the OK button on the error message is clicked both the form and message go away. The only problem is what if the user enters in a value that is not in the table and the ELSE option kicks in. Currently, without the onclick=windows.close() function, the form remains. If I put the function back in the error message and form disappear so the user has no idea what transpired. I guess I would like my cake and eat it too! Any ideas what I'm doing wrong? thanks,
  11. I have a javascript popup as an error in a php if (isset verification). I cannot tell whether or not the loop is working incorrectly or the popup is just not being called. from the code it appears to be working (the if (isset verification)) since the work I ask to be completed if the response from the if (isset) loop is false, then write the record into the proper table and that is not happening. So is there someone out there who can verify my javascript for the popup is correct or provide a means of validating my code in a test I would be grateful. Here is the code: <?php if (isset($_GET['param1']) && !empty($_GET['param1'])){ $prod=$_GET['param1']; echo "Your Prod Number is:\n$prod"; } elseif ($_SERVER['REQUEST_METHOD'] == 'POST'){ $imei=$_POST['param1']; echo "Your Bloody Prod Number is:\n$prod"; // Main PHP code for connecting to the database for production processing $con = mysql_connect("localhost","user","xxxxxx") or die('Connection: ' . mysql_error());; mysql_select_db("logdata", $con) or die('Database: ' . mysql_error()); //SQL query for is the Prod Num was completed fine, this will populate the PROD table accordingly. // This query is to generate values for validation. $grabit = "SELECT * FROM `Prod` WHERE `ProdNum` = '$prod"; $testdata = mysql_query($grabit) or die(mysql_error()); $testit = mysql_fetch_assoc($testdata) or die(mysql_error()); print_r('$testit'); ?? I get nothing from this command - It may be due to when I click submit the form is scheduled to close, and the information is not displayed. // variables from the SELECT Query $done=$testit['PassGood']; $batch=$testit['BatchNum']; $sku=$testit['ModelSku']; $type=$testit['ModelType']; $model=$testit['ModelNum']; $card=$testit['CardType']; $notes=$_POST['undernotes']; // variables for this section only! $qc =$_POST['qcstatus']; $Diag = 'Passed'; $ota =$_POST['TestResults']; // Test loop of the data inputted to verify the data inputted into the table. This is where I try to validate if a record for that Prod Num exists or not - not getting the error message at all. if (isset($done)) { ?> <head> <script language="JavaScript"> alert("This Unit has been passed as ALL GOOD. Please forward to Kitting."); </script> </head> <?php } else { mysql_query("INSERT INTO `ProdHist` SELECT * FROM `Prod` WHERE `ProdNum` = '$prod") or die(mysql_error()); //but this portion of the code is not working when I put in a Prod Number that is already in the table. // Notify the User that the record is being copied to the ProdHist Table. print "<p>This record was updated in the History Table.</p>"; // Insert the new data for this record in the main Prod Table. This code is also not working when there is a duplicate record in the table. mysql_query("UPDATE `Prod` Set `Diagnositc` = '$Diag' Set `TestResults` = '$ota' Set `undernotes` = '$notes' Set `DateRep` = Now() WHERE `ProdNum` = '$prod'") or die(mysql_error()); @mysql_query("DELETE FROM `Prod` WHERE `ProdNum` = 0"); mysql_close($con); } } ?> <body bgcolor="#CCCCCC"> <P> <BODY OnLoad="placeFocus()"> <!-- This section will create the form for the "all Good" Unit popup window. --> <form method="post" name="prod" action="repair.php"><font color="#000080" face="Arial"> <input type="hidden" name="param1" value="<?php echo $imei; ?>" /> <p><u><b><font size="2" font color="maroon" font type="Tahoma">Repair Section:</font></b></u></p> <p><font face="Arial" font size="2"> <b>OTA Pass/Fail: <select name="TestResults" size="1" name="TestResults"> <option value="NULL">--</option> <option value="Passed">Passed</option> <option value="Failed">Failed</option> </select></b></font> <font face="Arial" font size="2"> <td <font color="Navy" size="3" face="Tahoma"><b><u>Notes:</u> </b></font></td> <td><input name="undernotes" type="text" id="undernotes" size="35"> <p align="center"> <input type="submit" value="Repair Data Submit" name="submit" onclick="window.close()"></p> </form> So when I have a duplicate Prod Num the php code seems to be working... there is no INSERT or UPDATE being processed. I will be testing more on the results of a unique Prod Number being entered as well.
  12. gee thanks for pointing me in the right direction.
  13. I have seen a couple of these questions asked before but I cannot remember if there was ever an answer: I need to incorporate a barcode scanner for my forms in data entry... I have seen a few responses that we should use javascripts... but where can I find some reference material on javascripting for barcode scanners? Primarily for incorporating a tab to the next field without the standard carriage return being processed... and to get the submit button to work once I get the scanne to tab down to the next field. Any ideas?
  14. I have seen a couple of these questions asked before but I cannot remember if there was ever an answer: I need to incorporate a barcode scanner for my forms in data entry... I have seen a few responses that we should use javascripts... but where can I find some reference material on javascripting for barcode scanners? Primarily for incorporating a <Tab> instead of a <ENTER> when a field is scanned and/OR how to get the barcode cursor move to the next field if there is no way to set the <ENTER> function of the scanner to a <TAB>. Any ideas?
×
×
  • 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.