Validating 'required' form page data for save to database, Saving by php code file after succesful validation. Success message on |
Validating 'required' form page data for save to database, Saving by php code file after succesful validation. Success message on |
Freddz |
Jan 7 2019, 08:34 PM
Post
#1
|
Novice Group: Members Posts: 25 Joined: 7-January 19 Member No.: 26,791 |
Hello,
I have a form page where I check the mandatory inputs client-sided by the attribute 'required' (when clicking send button). When all required inputs are done the send button click... 1.) should call a php file 'dbinsert.php' which just contains the save process of the form data to a database. 2.) But the success message should be shown on the SAME page, on top of the form page. How can I implement this process under those 2 conditions? I suppose that the send button's 'action' attrbute should be empty and the php file has to be called via Ajax (within a Javascript function?) !? But unfortunately I fail in implementing THIS specific configuration. Could you help me, please? If so, please specify in your answer all necessary code lines like the form header, the submit button and the Javascript function that executes the Ajax call (and also fires the success message, I suppose)? Thank you so much! The following constellation does not work: * <FORM NAME="Betrugseingabe" ACTION="../cgi-bin/DBinsert.php" METHOD=POST> * <INPUT TYPE="submit" NAME="Absenden" VALUE="Absenden" ID="Schaltflaeche1" formtarget="_self"> |
Freddz |
Feb 13 2019, 11:13 AM
Post
#2
|
Novice Group: Members Posts: 25 Joined: 7-January 19 Member No.: 26,791 |
Oh thank you.
So I changed from ByName to ByID again. IDs of each form element fits to the append commands. But now a new recordset is not even created when pressing send button. I also inserted your two lines to get errors but nothing changed. I also opend Chrome dev tools to get logs (s. http://prntscr.com/mkmtuk) but there are so many functions and I cannot find any logs about my send process. So I still have no idea what the reason is that data are not saved to db or why formdata is not correctly handed over at 'ajax.send(formData);' to my dbinsert.php sql file. I am frustrated... Can you maybe instruct me in some way how I can find that out? Do you know a good description to quickly learn the usage of Chrome dev tools?... |
Lo-Fi Version | Time is now: 21st September 2024 - 07:26 PM |