Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. Have you ever programmed before??
  2. Do you have error checking turned on? I'd be surprised if line 6 doesn't throw a warning or something. Anyway - line 6 is trying to typecast a simple variable as an array and assign it (as an array?) to a var called $test. But then the next iteration is going to do the exact same thing with the next row, so basically you'll end up with the last row's value in the var $test. Perhaps you should turn on error checking when you are developing. And as an answer to your woes, try doing this: $test[] = $row5['name']; This will give you an array have the contents of each 'name' field in it.
  3. This sounds like a lack of understanding of database structure and normalized data. Add a table to hold this employment history - you will have multiple records for each employee. Be sure to have a common field between the Employee table and the EmpHist table so that you can link them together in your queries. As for processing the input form that has your html table on it, each column's <input> tag will have a name attribute on it such as 'name="ename[]"' and 'name="ecountry[]"' and 'name="efrom"' in the html and your php code will retrieve this data as an array - $ename = $_POST['ename'] which would create a php array called $ename. Do this for each input element name and then loop thru them all to collect each complete row of employment data and post each to your database.
  4. Are you talking about having a table produced by html show up on your page correctly (an html problem) OR showing the contents of a database table show up in your script or on the screen via some php output function?? Can't help if you can't explain.
  5. To elaborate on the previous response: Yes - you can make your user aware that there were no results found, although it is not 'technically' an error. It may be a user (input) error in that the item sought was not found in the table, but it is not truly an error. You should always check the results of a query for an error usually done with: if (!$preparation->execute()) { (show some error message here) ( handle the failure) } else { if ($preparation->num_rows ==0) { (handle no rows here) (handle the failure) } // continue on here if query was good and results were found .... .... After validating the query ran, you can then check if there were any results. Hope this helps.
  6. I don't see the point of using a 2nd window to show the input while it's still on the old window. If your concern is not losing the input data after you have processed it (in case of an input error), your php code can very easily just return the original screen with the input and any needed error messages displayed. Personally - I would find an application to be a bit klutzy if I had to look at an intermediate screen in order to use it. Plus - popup windows like yours are generally frowned upon.
  7. either you are in way over your head or you're trying to do something you should not be doing. Sounds fishy to me.
  8. Pretty general and vague question. What kind of slide show are you looking to do? (And that is itself a pretty vague question.) And as the previous responder said - you are probably looking in the wrong place. This kind of thing works better with a client presenting the images rather than php going back to the host each time.And have you tried searching google for a sample - there's probably a thousand out there.
  9. have you run a phpinfo to see what the current settings are? Or - you could just specify your require_once as: ("/php/required.php") btw - storing your php scripts within the web tree (public_html) is not a good idea IMO. They should be above 'public_html' to keep them away from prying eyes.
  10. So - you say you are reading the data successfully, but you can't post it in your database. So - rather than expect us to look at a whole lot of code, why not just post the part that is trying to post your database? Show the query you are using, Better yet - show us the error message you get from running the insert query.
  11. Are there different version of JS that treat my subject function differently?? I've read some posts that suggest it is true, but how does one get the desired result in those browsers that don't do as expected? I have a js function that sends a URI to a separate PHP script to run in the background and return a result that I then update my client's screen with. All my testing works just fine on IE9/10 as well as my ipad's Safari. But - my background php script (which sends me an email whenever it runs) is showing me an "undefined" value for a piece of data sent to it from the client which has been run thru this function.
  12. Once again - stupid typos !!**!! Was missing a quote on my name attrib for the dest field, causing function failure no matter what I tried.
  13. I am trying to copy some input values from one form to another using the onclick event of my submit button. The submit button in the "receiving" form looks like: onclick="return copyChoice(this.form)" and my function to do this looks like: function copyChoice(frm) { var evt_val=''; var cb_plyr_sel_val =''; // inputs are 'evt' and 'cb_plyr_sel' if (document.getElementById('cb_plyr_sel').checked) { cb_plyr_sel_val = document.getElementById('cb_plyr_sel').value; } evt_val = document.getElementById("evt").value; // now copy the values to the hidden ones in this form ??? alert("values copyied?"); return True; } My problem is in the ??? area where I am trying to place the two values I've captured into the frm object that I have from the submit button. I have tried a couple of ways like this: frm.evt = evt_val; // where evt is the 'name' of the input in this form (frm) AND: var formid = frm.id; document.getElementById(formid).evt = evt_val;    and neither of them worked. I know this since my alert at the end never arrives. So - given a form object, how do I reference the <input> tags within that form? The examples I've found (and tried to use here) don't seem to be working for me.
  14. Never use jslint before - what a pia! Except for "spacing" errors and jslint's preferred location of curly braces, my script seems ok. Here it is - something that worked before but now doesn't. I have added some 'alert' statements to help ensure it is working (even tho it doesn't). OH - and that's another thing jslint didn't like - it wanted me to declare 'alert'. Didn't know one had to do that var rtnbtn_used = false; function changeAction(btn) { alert("in x changeaction with " + btn); if (btn === 'btn') { rtnbtn_used = true; return true; } else { if (!rtnbtn_used) { alert("newwin"); document.getElementById("thisform").target = "newwin"; rtnbtn_used = false; return true; } else { document.getElementById("thisform").target = "_self"; return true; } } } Basically - I call this function with an onclick from my 'return' button in my screen as well as from my onsubmit event of my form. If the return has been hit and will do a submit, the onclick sets a switch which when my form calls this function will trigger a normal return to the same window. But if a different button has been clicked to trigger submission, the lack of the "rtnbtn" switch being 'true' will cause the target be set to open a new window. I use this on my windows that are going to build a pdf for display and I don't want to replace the current window since the user can then simply close the pdf window and generate another pdf. If I just used the single window, then a return (back) from the pdf displayed would send them back a screen too far in my appl. making it tedious to use the pdf generator repeatedly.
  15. You certainly are a newbie. Your html is not setup properly at all. Try looking at a book and learn the structure of an html page and you'll quickly see why your js is not working. Also you are missing other important tags. (quick answer - scripts must go in the head section of an html page along with css)
  16. Seem to be having a problem with my php/js application since I upgraded my laptop with IE9. My pages were written to use a JS function to modify the target of my form before submission for certain actions on that form. Sometimes I want the php script to return its output back to the current page, but for other actions (depending on the button clicked) I want to send the php script output to a new window. Well, it doesn't work any more and I've found that it will work IF I click on Tools,Compatibility View in my browser. Not totally understanding what the compatibility view means and how it would impact my appl and not wanting my users to have to worry about this, is there something I can do in my JS to enforce the new target?
  17. OK - I changed the way I'm determinging the numeric value of my keyup result to use two arrays - one for normal number keycodes and another for the numeric keypad keycodes. My input is being processing properly now. Please see my new post on how to convert an Enter key to a tab keystroke if you would like to assist me there. Consider my problem closed.
  18. As you see, I'm capturing individual keystrokes. The purpose is to monitor data entry and modify the input as it happens. Can regex be used for that purpose? Specifically I'm capturing day and time values and trying to do it all numerically to lessen the load on the person doing the input. So instead of having to type "Fri. 05:00" as an example, they need only type 10500 which gets modified as follows: 1 -> Fri. 0 -> Fri. 0 5 -> Fri. 05 0 -> Fri. 05:0 0 -> Fri. 05:00 The use of the numeric keypad is crucial in this situation - to not be able to handle it would be a great weakness in my appl. So getting back to my question - why does my JS not recognize the number keypad's inputs properly?
  19. I"m using the following code to detect and interpret numeric inputs: function handleTimeEntry(event) { var obj = event.target||event.srcElement; var kycode = event.keyCode; var ky = String.fromCharCode(kycode); alert("got kycode of "+kycode+ " leading to ky of "+ky); blah,blah,blah } When I use the normal number keys - no problem. But when I use my numeric keypad at the end of my keyboard I get the following: (with num lock on): a 1 keypress returns a kycode = 97 and ky = a which my script rejects as non-numeric. Other keys do similar 'wrong' things. (with num lock off): a 1 keypress returns a kycode =35 and ky = # which is also rejected. According to the keycode charts I've read online, the kycode values I'm getting are correct with numlock on according to the stenciled characters that are on the keys I'm hitting, but the result of "fromCharCode(kycode)" is not what I should be getting. Ideas?
  20. Yes - so I figured. A whole new view of the httprequest usage. Thanks for the help!
  21. The whole concept here is to let the onclick function call (handleLogin) determine whether my html form is submitted.
  22. Ok - Here's what I added: . . . var myreq = new XMLHttpRequest(); myreq.open("GET", url, true); myreq.send(null); rtnval=false; myreq.onreadystatechange = function() { if (myreq.readyState == 4) { if (myreq.status == 200) { /* handle the data returned from the above GET request */ allText = myreq.responseText; rtnval = handleResponse(allText); if (rtnval) alert("Got a response - returning "+rtnval); return rtnval; } else { alert("Error processing login attempt - message follows: "+myreq.statusText); return false; } } } return false; /* always return false from this function */ where I added the vary last line, which is now the last of my handleLogin function. So my alert shows that the user has entered valid credentials and that the anon func is about to return a true value, but my submit never happens now - so I guess the return false is working well. Are you sure that's how to end that function?
  23. I never realized that was how this worked. It's code I lifted and have implemented 2-3 times successfully. Apparently I should re-visit those places as well. So - add a return false after the anonymouse function's place? And so how does the result of the anonymous function call then get 'handled'?
  24. I take it back!! One test and I thought I had it, but alas... NOT! So - any ideas from the code I last submitted?
  25. ok - it is solved. My return was created from a look at a string result. I did not properly receive the string value of "true" or "false". I changed it to properly convert it to Boolean and now I get a proper return.
×
×
  • 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.