Skip to main content
Known Participant
September 1, 2018
Question

How to prevent a PHP file called in action form to appear as a page ?

  • September 1, 2018
  • 1 reply
  • 1260 views

With this line <form name="myForm" id="myForm" action="manageMySQLGuests.php" method="post"> I cannot avoid manageMySQLGuests.php to appear as a page whilst only  CRUD transactions with MySQL occur in this PHP file (so that nothing needs to appear as I manage failures in another way).

This topic has been closed for replies.

1 reply

Legend
September 2, 2018

Youre not giving us enough information to provide you with an answer. If you dont have any client side validation on the form it will just go through to the manageMySQLGuests.php file.

The post has been marked as correct for some reason. If it wasnt you who marked the post as correct then it shouldnt have been but then again its a habit of someone going through the posts guessing at the correct answers, some which have been marked as correct are plainly incorrect or not the best answer provided.

Please only mark the answer as correct IF you are positive that the provided answer IS correct!

Known Participant
September 2, 2018

It's me who marked the question as answered but by error, I realized it but it was not possible to change back the status. The answer was correct as the PHP file that contains only background process did no longer appear on an new page on a new tab but did not solved completely the problem in that the page referring the PHP file is still refreshing when the form is submitted ( by the instruction outside of the form myForm = document.getElementById('myForm"); form.submit(); )

If someone is able to do it, unmarked this question as "assumed answered".

Legend
September 2, 2018

I assume that you are validating the form input fields using javascript?

If you don't want the 'manageMySQLGuests.php file' to be activated UNTIL all the necessary information has been provided by the user then you would need to use:

return false;

if the javascript code encounters a vaildation error. That will stop the script running any further.