Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by jxfish2

  1. Thanks Ingolme for your comments and help. I managed to fix the issue, and the code is now working as intended. Just an FYI... I have a lot of error checking, and data validation going on inside of these scripts... A lot... And, my query, and update commands are very specific. No user can execute any of the update commands, unless logged in, and the ID is validated each time a submit button is selected. Additionally, I did not post any specific table names here, and a number of other fields necessary to make each of the updates work, were never posted here either. And finally, this code sits behind the firewall, and is only accessible via the company intranet. There is no external connectivity to these servers, or to my webpages. Again, thank you for your input, and have a great week. JCF
  2. Hi Justsomeguy, I am calling this same script from within many other <form> entries in this code, and it is working everywhere else, just as intended. But, none of my other form entries contain an embedded <select> clause. Is there no way to make this form, with the embedded <select> clause, call this same php script? It's been awhile, but you've helped me in the past, and I trust your judgement. But, I have never really used JavaScript before, and I've managed to get my PHP code to do what I want so far. If there is any way to make the form call this same php script, while there's an embedded <select> statement, this is what I would prefer to do... If there is no way to make this work the way I want, then I will be forced to use JavaScript. But, I don't really understand JavaScript, so I might need some real help there. JCF
  3. Hi Ingolme, Note that I set the variable to "", prior to reading in the new data from the POST submission. In theory, the only time this condition would be true, is if the new value was read in by the page refresh. And I thought that was the purpose of the onchange function, so that I would not need a submit button. So, if I want the onchange to execute the filename php script, what should I put in the <select> statement, and what should I put in the <form> statement? I CAN add a submit button if necessary, but I really did not want to go that route. But, I've already tried using a submit button, but something is still wrong in the <form> and <select> statements. Note that I am calling this same php script in numerous other <form> entries within this same code, and it is working everywhere else. I just do not have any other embedded <select> statements within any of my other <form> entries. JCF
  4. Note that all of the environment variables are initialized / read in, at the beginning of the script. I just did not include all of them in the above example. Also note that I am using this same form syntax for multiple other queries and database updates, within this same script. The only difference, is that this new form requires a dropdown select function, and I have not been able to find the correct format / syntax so far. JCF
  5. I've built some pretty sophisticated PHP / HTML / MYSQL scripts at work, but in each case, the action recalls, and reloads the page. So far, I have not needed to use JavaScript, and the pages work exactly as intended. For my purposes, so far, this has worked quite nicely. But, I have a new requirement, that I can not seem to get to work. I am trying to initialize a form, but the form includes a select dropdown box. I would really like to have this update the database entry, and the display, whenever the value in this dropdown box is changed. I am including some snippets of what I have in place so far, and bear in mind, that I have tried many different things, but nothing has worked so far... Note that the webpage itself changes the value, but no SQL code is going back to the database itself: <form action="Get_All_Assets.php" method="POST"> <input type="hidden" name="alt" value="<?php echo $row['alt_code'];?>" /> <input type="hidden" name="pri" value="<?php echo $row['prio'];?>" /> <input type="hidden" name="loc" value="<?php echo $row['location'];?" /> <center> <select onchange="Get_All_Assets.php" name="NEWPRIO"> <option value="?php echo $row['prio'];?><?php echo $row['prio'];?></option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> </center> </form> Remember, that the goal is that we can change the priority of the asset, on the fly, both on the current html display, as well as in the database itself, so that other users will see the updated priority, whenever they access the record. At the beginning of the PHP file, I am setting the NEWPRIO environment variable: $NEWPRIO=""; $NEWPRIO=$_POST['NEWPRIO']; Next, I check to see if the $NEWPRIO variable is set to a value, other than NULL or blank: if ("$NEWPRIO" != "") { mysqli_query($con, "UPDATE table SET prio='$NEWPRIO' WHERE location='$LOC' and alt_code='$alt_code';"); } Again, when I click on the dropdown box and change the value, it changes on the webpage, but not inside of the database. Is the onchange function in the right location? Is the onchange function correct in this situation? I was not able to find any examples that actually used these same conditions, so I was just trying to wing it... Any help, or "specific" suggestions would be greatly appreciated. Thanks in advance, and have a great day. JCF
  6. Thanks for your help James, Have a great week. JCF
  7. Sorry, I put the post here, because it was similar to the previous post. I did not realize that I needed to create a new post, for a similar topic.
  8. Thanks James, You answered one of my questions. I built a huge set of data driven, web-based tools, all with PHP and HTML. These pages are working very well, and I've gotten a lot of "atta-boys". The company (a fortune 500 company) has already told me that I can patent these tools within their infrastructure. But again, I have managed to complete the entire project with nothing but PHP and HTML so far. To keep it simple, I would prefer to stay with PHP and HTML if possible. I know one way to do it using only these two languages, but it is probably not the best way, and I was hoping to find a simpler, more efficient way to accomplish my end results. I've become very efficient with what I do know, but I'm self-taught, and there is a lot that I have not done, or tried before.
  9. JamesB, Thanks for your post. I am trying to use a syntax that is close to what you posted, because I am more familiar with a syntax somewhat different from what you posted. Using the below syntax, I am getting the dropdown boxes to appear correctly, but I am unsure of how to make this change to the database. Here is what I have so far, and again, at least the values are showing properly in the dropdown box: <td> <form id-'changePriority'> <input type="hidden" name="alt" value="<?php echo $alt;?>" /> <input type="hidden" name-"loc" value="<?php echo $loc;?>" /> <center><select> onchange="ChangePriority()" name="Priority"> <option value="<?php echo $row['priority'];?>"><?php echo $row['priority'];?></option> <option value="1">1</option> <option value="2">2</option> ................. </center> </form> </td> <?php> function ChangePriority() { mysqli_query($con, "UPDATE table SET priority='$Priority' WHERE alt='$alt' and loc='$loc'"); } It appears as if the form is working, but the function is not. Any assistance would be greatly appreciated. JCF
  10. I have a number of PHP / HTML pages that are database driven. I can query the database, and update the database, using various forms that are tied to an external page. I am at a point now, where each listed data element, or asset, has a priority associated with it. If possible, I would like to display the priority column with values between 1 and 5. However, I need to allow our team members, those who have authority to make changes, the ability to change the priority of any given asset, as easily, and expeditiously as possible. I know that I can display the priority values in a dropdown format, with the current priority set to display for each asset. My question is, how can I display these default values, allowing the end user to reset the priority, by simply selecting a different drop-down priority value? I know that I can do this using a separate "Submit" button, but the page is already too crowded. I would really prefer to submit the data, as soon as the drop-down selection is made, without the need to press, or select another action button. Is this possible, and if so, how? Thanks in advance, JCF
  11. I know how to turn off caching for an entire webpage, but I have a situation where I do not want to turn off caching for the entire webpage. But, I would like to turn off caching for 2 particular "Dynamically generated" HREF links, within the main webpage. Is there a way to do this, through either the TR or TD tags? What about some other tags, within the TD tag? What about within the <a href... tag? Thanks in advance JCF.
  12. Ok, I have reached a point where I need some help, and pointing me to reference documents is not helping anymore, because of the way my code is written. Here is what I have so far: function getReprNotes() { ?> <script> var NOTE = prompt('Please enter any appropriate reprocessing request notes'); alert(NOTE); </script> <?php getReprNotes() Note that the above code is generating the prompt popup window. Note that the above code is populating the HTML "NOTE" variable. Note that the above code is causing the parent page to wait for the popup input. But, I can not figure out how to get the HTML "NOTE" variable, back into the PHP code... I need to convert the HTML variable "NOTE" to a PHP variable! But, in this particular code, I am not using an "onclick" button, or a submit button... How do I pass this HTML variable back to the parent PHP process?
  13. Using an "if / else" conditional statement, when a certain condition is met, I want to display a popup window that prompts the user to enter some appropriate text. Once the text has been entered, I simply want the code behind the popup window to populate an environment variable, that will carry forward, throughout the remainder of the backend PHP code. I would have thought that was very simple to do, but I have not found any code to do that, without using an "onclick" function, or some other similar function... In my current code, I can not use an "onclick" trigger to execute the function. Any help would be greatly appreciated. JCF
  14. That is why I asked for help! Unfortunately, I am too junior to understand your very vague answers. If you really want to help, I'll need some examples of what I should do. Telling me that I need to use Ajax, or that I need to use a callback, has not helped me at all. The code that I posted above gives me a popup window, and it allows me to populate that window. The only thing it is not doing is populating the environment variable. If you could tell me what I need to make that work, without needing to press another button, but instead triggering the popup window after a certain logical condition has been met, that is what I need. If you can give me some examples of code that will do what I want, that would be much better, as I have not been able to find anything close to what I am trying to do, in any of the pages I've found so far. Or, if I did find something that would do what I need, I did not understand it, or recognize it for what it was. JCF
  15. Ok, I am a little closer to my goal... Here's what I've come up with so far: I define a function: function ReprPopupWindow() { ?> <script> type="text/javascript"> $REPRNOTES - prompt("Please enter any appropriate reprocessing request notes") </script> <?php } Then, I call the function inside of my code using the following line: ReprPopupWindow() This causes the popup window to appear, and it also stops the parent script from refreshing the page. Essentially, the parent script is waiting for input, just as I want it to. However, using this exact code, the variable is not being initialized. I need the variable "$REPRNOTES" to be populated with the text entered in the popup box. Any help would be greatly appreciated. Thanks in advance, Joe
  16. JustSomeGuy, Thanks for the referral, but after spending several hours of research, I'm still no closer to getting the script to wait for input. Here's what I've tried so far: 1) ?> <script> { $REPRNOTES = prompt("Please enter any appropriate reprocessing request notes") } </script> <?php 2) echo '<script type="text/javascript"> { $REPRNOTES = prompt("Please enter any appropriate reprocessing request notes"); } </script>'; 3) $REPRNOTES = "readline ( string $prompt('Please enter any appropriate request notes'))"; 4) $REPRNOTES = "?> <script> prompt('Please enter any appropriate request notes'); </script> <?php"; 5) $noteprompt = "Please enter any appropriate request notes"; $REPRNOTES = readline ("?> <script> { prompt('$noteprompt'); } </script> <?php"); I get the popup with 2 of them, but the script just continues, without waiting for the input. I am relatively new to PHP and webpage development, and this one is kicking my butt. Note1, I began looking at the "readline" command, after JustSomeGuys suggestion. Note2, This code is only supposed to execute, if a certain condition is met. I am trying to execute this code, all within a single PHP script. Aside from this one single popup window, I am not calling any other external scripts or functions. Everything else is working as intended. I would greatly appreciate it, if anyone could tweak one of the above examples, or if something completely different is needed, that they give the exact syntax, along with a similar example. Thanks in advance, JCF
  17. I have a similar question, but not quite the same. When a user clicks on a Submit button, for a different function, it checks to see of the user is authorized to access those specific buttons. If the user has the authorization, a popup window should automatically open, requesting that he enter some appropriate information. This information needs to be stored in a variable, which will then be passed to the parent script. When the user is done entering the information, the action continues. The issue I'm having right now, is that the popup window is opening, but the parent program is not waiting for the javascript input. The parent program just continues on its merry way, without the text that was supposed to be included. All of the example code that I've seen requires an "onclick" statement, which I believe should not be required, as a "Submit" button has already been issued. How do I get the parent program to wait for the javascript popup window entry? JCF
  18. I didn't design the table layouts... I'm just trying to use them... And, remember that I am fairly new to SQL, and very new to complex queries... Again, I did not design the tables, and I have no control over their layout... So, comments like "Seems like a pretty crummy table design" don't help! If anyone can add some constructive comments, and help me fix the query so that it returns the data that I need, I would greatly appreciate it... Remember, the query is already returning valid data... The issue is this: The query returns a complete subset of assets from the primary table. For each asset in the primary table, there is a corresponding set of chronological data, containing a tracking history for that asset. I need to return the latest tracking record for that asset, from the tracking table. I could do this programmatically, but I've already tested that, and it takes much too long to do it this way. I need the sort, and limit, to occur within the primary query, for each asset returned. I can query, sort and limit the output from the tracking history table, if I query that table by itself, but my issue is that I don't know how to incorporate that query, sort and limit as a subset of the main query... I know that it will be MUCH faster, if I can do this within the main query, but I just don't have the expertise to do it on my own yet. Again, any help would be greatly appreciated. Happy holidays, JCF
  19. I am a beginner / intermediate MySQL user, but I need what I believe is a fairly advanced sql query, and I haven't been able to figure it out on my own. If someone could please help, I would really appreciate it. Here is my current query, and it IS returning valid data: $result = mysqli_query($con, "SELECT r.asset_title, r.alt_code, r.studio, r.type, r.start_win, r.end_win, r.rcv_date, r.pub_date, r.date_r4qc, r.qc_status, r.qc_notes, r.re_qc_date, r.promo_date, from_unixtime(ft.in_time) AS in_time, f.description AS description, left(ft.file_name, 20) FROM calendars r, tracker ft, folder f WHERE (r.alt_code = left(ft.file_name, 20) and ft.folder_id = f.id) limit 100"); Here's what I'm trying to accomplish: Most of the data that I need is in a single table, but there is one single field in each of two different tables, that I need to incorporate into my web output. The problem is, that the current status, and the date associated with that current status, are not sorted in any specific order. For each asset in the "calendars" table, I need to list all of the statuses, to include the "latest" status from the tracker table... In other words, for each asset in the "calendars" table, I need to look at the latest entries in the "tracker" table, then sort the "tracker" table output, returning the latest entry from that table. The above query IS returning valid data, but the data being returned from the tracker table is not always the latest data... How can I modify the above query to get just the latest entry from the tracker table? Again, any help would be greatly appreciated. Thanks in advance, and Merry Christmas to all... JCF
  20. I am using checkboxes to select specific criteria to use within a MySQL query string. In my case, as long as the checkboxes do not change, I want to keep the previously selected checkbox values, and pass them on to any additional page sorting that's done after the initial checkbox selection process. I'm already initializing my MySQL query string successfully, using these checkboxes. But, once I have the data set that I want to work with, I need the ability to re-sort the columns, or refresh the page, based on my initial selection criteria. But, I have not been able to get the initially selected criteria to "persist", when I sort the columns, after the select has finished. How can I take the incoming variables, and make them persistent? How can I take the incoming variables, and pass them to the sort process? Thanks in advance. JCF
  21. Thank you... Thank you... Thank you... With this new information, I was able to get the dropdown menu to work, and the script is now working as I had originally intended for it to work... Have a great weekend! JCF
  22. Here's what I entered for my code: ?> <td> <center> <form action="Get_Old_Assets_By_Alt.php.20130925" method="post"> <select name="stat"> <option value="2"> Abandon </option> <option value="3"> On Hold </option> <option value="4"> Provider Input Requested </option> <option value="5"> Working </option> <option value="6"> Complete - Not Yet Delivered </option> <option value="7"> Complete - Delivered </option> </select> <input type="hidden" name="update" value="<?php echo $stat;?>"> <input type="hidden" name="code" value="<?php echo $alt;?>"> <input type="submit" value="Update"></input> </form> </center> </td> <?php Note that the "$code", or $alt value is coming through to the refreshed page. But, the "$update", or $stat value / variable is NOT coming through to the refreshed page. The $update, or $stat value is the one coming from the dropdown menu. If you can correct the above dropdown code, so that the value is initialized correctly, I would be forever in your debt... I would say that I'd give you my first born, but she's already 30, and out on her own... ;-)
  23. Is it possible to use something similar with the select dropdown function? example: echo '<form action="Get_Old_Assets_By_Alt.php?update=$stat&code=$alt" method="post"> <select name="stat"> <option value="2"> Abandon </option> <option value="3"> On Hold </option> <option value="4"> Provider Input Requested </option> <option value="5"> Working </option> <option value="6"> Complete - Not Yet Delivered </option> <option value="7"> Complete - Delivered </option> </select> <input type="submit" value="Update"></input> </form>'; Where the variable "code" could have been set via previously defined variable assignment. If this is possible, this could work!
  24. YESSSSSS! That worked... First time!!! You are a wonderful man!!! Just wish we could have resolved the dropdown issue this easily! Remember, I gave up on that one! Have a great weekend.
  25. I have a working PHP created webpage, that I want to give a data sort option to. Currently, I am calling one of 6 different scripts, to accomplish this data sort routine. If I can just figure out how to pass the sort parameter back to the script itself, so that it will reload the page, using the new sort variable, I can combine all 6 scripts into a single script, making it much easier to maintain. My current button selection code looks like this: <td><form action="Get_Old_Assets_By_Alt.php" method="post"><input type="submit" value="Sort By Alt Code"></input></form></td><td><form action="Get_Old_Assets_By_Title.php" method="post"><input type="submit" value="Sort By Title"></input></form></td><td><form action="Get_Old_Assets_By_Prov.php" method="post"><input type="submit" value="Sort By Provider"></input></form> </td> I want to combine all of the code under a single script called "Get_Old_Assets.php", but I need to pass in one of the following variables: alt title prov I already tried the following: <td><form action="Get_Old_Assets.php?alt" method="post"><input type="submit" value="Sort By Alt Code"></input></form> </td> But, I can't seem to get the script to read in the URL argument. I tried several different things when refreshing the display. Here are a few of my attempts: $OPT=$argv[0]; $OPT=$argv[1]; Nothing! Actually, there were several more, but they're not worth mentioning. Inside of this same script, I want to initialize the variable "OPT", making it the argument that I'm trying to pass to it: Then, I'm trying to use conditional statements to check variable value: if ($OPT == 'alt') { .... } I also tried a "$_POST[name]", to recover the variable, but it didn't work either. This is not supposed to be an interactive prompt. It should only pass a new variable, when one of the button options is selected. Any help would be greatly appreciated.
  • Create New...