PHP Post - Run Function before Submit

Asked

Viewed 225 times

1

Here’s what I can’t do:

Let’s say my system url is www.meusistema.com.br and I need to send my system information to another one...

In my system I have the following form www.meusistema.com.br/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>';
    }
?>

To the system www.othersstema.com/gerarpdf.php I need to send the data entered in the field text_example concatenated with variable text example

In short:

I need to perform a function PHP to process the form data before the submit for www.othersstema.com/gerarpdf.php.

Edited... Note: echo 'document.getElementById("form").submit()'; <--- It doesn’t do Submit.

RESOLVED

I’m not doing the submit straight to the otherness, I created an "intermediate" php that treats Submit and sends the data to the otherness

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

</script>
  • Can you detail a little more your problem? You want a request HTTP POST be made from your site to another site?

  • That the Submit (post) from my site to the other. This quiet... But what I don’t know is to process the data from the "example" (Hidden) field before Submit

  • See this link from stackoverflow.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.