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 18 2019, 07:36 AM
Post
#2
|
Novice Group: Members Posts: 25 Joined: 7-January 19 Member No.: 26,791 |
To solution 1: The idea with the iFrames is a good one. Unfortunately NOF does not seem to support iFrames.
To solution 3: See my answer to Charles. To solution 4: This seems to be the easiest solution. But I didn't had time to ask my server provider yet... Will come back to this point soon. To solution 5: I understood that the form page infos are within the dbinsert.php file. So you JUST work with this file but don't habe any html at all. But NOF doesn't support that. Did I misunderstand you here? |
Christian J |
Jan 18 2019, 12:44 PM
Post
#3
|
. Group: WDG Moderators Posts: 9,722 Joined: 10-August 06 Member No.: 7 |
To solution 1: The idea with the iFrames is a good one. Unfortunately NOF does not seem to support iFrames. That NOF version must be really old then. Can't you add just the iframe HTML manually (with a text editor)? QUOTE To solution 4: This seems to be the easiest solution. But I didn't had time to ask my server provider yet... Will come back to this point soon. Or maybe it's enough to rename the form page to something like "example.php" to make PHP code run in it? QUOTE To solution 5: I understood that the form page infos are within the dbinsert.php file. So you JUST work with this file Yes it's exactly the same as solution 4, except that the URL is different. QUOTE but don't habe any html at all. It does have HTML, but it only prints the form before it's submitted, and only prints the success message after the form is submitted. QUOTE But NOF doesn't support that. You will have to write the combination of PHP and HTML yourself, of course. |
Lo-Fi Version | Time is now: 21st September 2024 - 06:23 AM |