I'm trying to write an HTML file that does the following: It takes one set of form fields with a common name, and submits them to a file "delete.py", and then it takes a different set of form fields and submits those values to a "test.pl" file. This all happens when I hit the submit button. I don't want to to be redirected to the "delete.py" page, but I do want to be redirected to the "test.pl" page on submit.
Is this possible? How can I do this?
If this is too complicated, what I was thinking was making the delete.py into an intermediate redirection page, that carries forth the post values meant to be sent to the test.pl page. I wouldn't know how to redirect the post values though, so If someone thinks that this works out better, I would appreciate knowing how to redirect the post values.
Thank you.
You can either:
Submit to an iframe
, using the target
attribute of the form.
...or you can submit using AJAX.
You could have delete.py
execute some code and then do a header redirect to test.pl
as long as your delete.py
doesn't write anything out to the page.
Here is how to do the header redirect:
Status: 302 Temporarily moved
Location: http://some.org/new-URL.html
In Python, at the end of your script:
print("Status: 302 Temporarily moved")
print("Location:http://some.org/new-URL.html")
print # to end the CGI response headers.
Make sure you don't have any other output prior to this on that page.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.