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 |
Jan 21 2019, 05:27 PM
Post
#2
|
Novice Group: Members Posts: 25 Joined: 7-January 19 Member No.: 26,791 |
My code is okay, isn't it?...
Yes, I have a root server. However, it was basically installed by the provider and I am not a web specialist. Could you clarify the points 1 and 2 above maybe?... It is just to see what the current apache configuration is. Unfortunately it seems as if it is not possible to check apache via command line for its current configs, is it? I don't like to have a mixture of php and html files. Don't want to run away from that little apache config problem... What do you mean by "It is just a matter of preference"? Shouldn't the current code work fine if the internal php code will be interpreted/cared?... |
Christian J |
Jan 22 2019, 05:55 AM
Post
#3
|
. Group: WDG Moderators Posts: 9,661 Joined: 10-August 06 Member No.: 7 |
My code is okay, isn't it?... The PHP yes, otherwise it wouldn't work with a .php extension either. (It's not valid HTML4 though, but that doesn't affect PHP.) QUOTE Could you clarify the points 1 and 2 above maybe?... It is just to see what the current apache configuration is. Unfortunately it seems as if it is not possible to check apache via command line for its current configs, is it? Sorry I don't know. Maybe this could work: https://stackoverflow.com/questions/2715294...d-configuration You can also get a lot of PHP configs with http://php.net/manual/en/function.phpinfo.php QUOTE I don't like to have a mixture of php and html files. Don't want to run away from that little apache config problem... Again, the easiest is to ask the provider. There are lots of different .htaccess directives used for this, depending on how Apache is used. QUOTE What do you mean by "It is just a matter of preference"? Shouldn't the current code work fine if the internal php code will be interpreted/cared?... Yes. By default, the PHP engine is only used for files with .php extensions. But you can change this in the preferences to .html, .foo or whatever extension you like. |
Lo-Fi Version | Time is now: 27th April 2024 - 07:27 AM |