-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
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.
-
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.
-
either you are in way over your head or you're trying to do something you should not be doing. Sounds fishy to me.
-
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.
-
php ini not working (or doesn't seem to be)
ginerjm replied to ReeceSayer's topic in PHP Coding Help
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. -
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.
-
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.
-
Once again - stupid typos !!**!! Was missing a quote on my name attrib for the dest field, causing function failure no matter what I tried.
-
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.
-
re-setting target attrib and Compatibility View?
ginerjm replied to ginerjm's topic in Javascript Help
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. -
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)
-
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?
-
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.
-
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?
-
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?
-
Yes - so I figured. A whole new view of the httprequest usage. Thanks for the help!
-
The whole concept here is to let the onclick function call (handleLogin) determine whether my html form is submitted.
-
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?
-
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'?
-
I take it back!! One test and I thought I had it, but alas... NOT! So - any ideas from the code I last submitted?
-
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.
-
This is the js that is called from the submit buttons. function handleLogin(btn) { var uid = document.getElementById('uid').value; if (uid=='') { alert("You must enter a name"); return false; } var pswd = document.getElementById('pswd').value; if (pswd=='') { alert("You must provide a password"); return false; } /* Now do an xmlhttprequest to validate the credentials Returned value will be similar to above returned values */ url="http://jimginer.net/bowling_login.php?uid="+uid+"&pswd="+pswd+"&btn="+btn; alert("in js_login_test.php calling bowling_login via xml"); /* create a var to do the process */ var myreq = new XMLHttpRequest(); myreq.open("GET", url, true); myreq.send(null); 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("returniing to button with true"); return true; } else { alert("returniing to button with false"); return false; } } else { alert("Error processing login attempt - message follows: "+myreq.statusText); return false } } else { } } } The buttons that call this function look like: <input type="submit" name="btn" value="Log In" onclick="return handleLogin('LogIn')"> <input type="submit" name="btn" value="Register" onclick="return handleLogin('Register')"> As you can see my alerts say one thing, but my results are different.
-
Nice idea, but I need to know which 'submit' button was clicked.
-
OK - I've done this before, but I'm having a problem now. I have a form with a submit button declared as <input type="submit" name="btn" value="Log In" onclick="return handleLogin('LogIn')"> The onclick routine - after much debugging - is working and at the end of its processing I have this: allText = myreq.responseText; rtnval = handleResponse(allText); if (rtnval) { alert("returniing to button with true"); return true; } else { alert("returniing to button with false"); return false; } The alerts are displaying that the return value is "false", yet my original button performs the submit, which I know because the script in the form's action is being called - when it shouldn't be. I hope I've provided enough info - does anyone see what I'm not?
-
For anyone following my dilemma - here's my solution (still in the works, but designed) My main menu link has an onclick event on it that gets a boolean answer from the js code - this will then either call my appl's script, or stay right there on the menu (false = no submit). The onclick js function will open a dialog box (a hidden div actually) containing my login form fields. The form will receive the info from the user and on the 'log in' button another onclick will call a js function that grabs the input, makes an httprequest call to a php script that validates the user's entries and returns true or false (with a message). This is the result that is passed all the way back to the original menu onclick.