Jump to content

jxfish2

Members
  • Posts

    34
  • Joined

  • Last visited

jxfish2's Achievements

Newbie

Newbie (1/7)

1

Reputation

  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
×
×
  • Create New...