Reputation: 173
I need to submit a form to a url for processing, and also insert the form fields to a database. The form is standard HTML, and the action is currently set to :
<FORM name = "HTML_FORM" METHOD=POST ACTION="https://urlhere/MRcgi/ProcessIncomingForms.pl">
My first thought was to change the action to a custom php page,which would
But - and this is my question- not sure if they can be done and how to do- in sequence??
Note: I dont have access to the ProcessIncomingForms.pl script, and I dont think this will matter but, the form fields don't match the database fields, so I will also have to do reassignments before I can submit into the database. Ex:
$help_user = $_POST['username'];
$help_dept = $_POST['help_dept'];
Upvotes: 1
Views: 1235
Reputation: 1526
Change the action as you suggested, then on the new php page insert into the db as normal then create a form and submit it for the user:
<form action='https://urlhere/MRcgi/ProcessIncomingForms.pl' method='post' name='frm'>
<?php
foreach ($_POST as $a => $b) {
echo "<input type='hidden' name='".htmlentities($a)."' value='".htmlentities($b)."'>";
}
?>
</form>
<script language="JavaScript">
document.frm.submit();
</script>
Upvotes: 1