Ok,
So I have a form that is on page 'index.html'. The user submits the form, which then goes to a processing page, say 'processing.php'. I would like call this processing page from the index page, assign the return value to a variable, and go from there.
The problem I am having is that the page should only be called when the user submits the form on index.html page. So how can I call this processing page before the page actually gets submitted and sent to that page? (I don't know if I am making sense, but I want the user to hit submit, then that action calls on processing page which returns the result back to the index page to display)
Any suggestion on how to approach this?
If your index.html page is really index.html and not a redirect to a PHP script, you're going to need something that can dynamically update the DOM, ie: Javascript. You can go with JQuery AJAX functions to return the results to the index.html page and update elements on the page.
Or you could just make an index.php that submits to itself, and only returns the form results if your form variables are present in $_POST.
You can use jquery with ajax.
Or, you just submits normally:
<form action="processing.php">
and in your processing.php, after the "processing", it redirects to index.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With