PHP Post - Execute function before Submit

1

I can not do the following:

Let's say that the url of my system is www.mysite.com and I need to send information from my system to another ...

On my system I have the following form www.mysite.com/index.php :

<form method="POST" name="form" id="form">
    <input type="text" name="texto_exemplo_form" id="texto_exemplo_form">   
    <input type="hidden" name="exemplo_hidden" value="<?php echo $exemplo; ?>">
    <input type="submit" name="submit" value="Enviar">
</form>

<?php
    $exemplo = "";

    if(isset($_POST['submit'])) {
        $exemplo = "Texto do Form vai ser concatenado com este...";

        $txt = $_POST['texto_exemplo_form'];   
        $exemplo = $exemplo . $txt;
        echo '<script>';
        echo 'document.getElementById("exemplo_hidden").value = ' . $txt . ';';
        echo 'document.getElementById("form").action="www.outrosistema.com/gerarpdf.php";';
        echo 'document.getElementById("form").submit()';
        echo '</script>';
    }
?>

For the system www.system.com/gerarpdf.php I need to send the data typed in the text_example field concatenated with the text of the example variable >

In short:

I need to run a PHP function to treat form data before submit for www.system.com/gerarpdf.php .

Edited ... Note: echo 'document.getElementById("form").submit()'; Do not submit.

RESOLVED

I'm not doing the submit direct to the other system , I've created an "intermediate" php that handles the submit and sends the data to the other system

>
<script language="JavaScript">
    window.onload = function() {
               .
               .
               .
        document.getElementById("form").submit();
    }

</script>
    
asked by anonymous 11.11.2018 / 21:39

0 answers