I would like to have the file created with the data that is in the form

1

The form is something simple like

<head>
</head>
<body>
    <form action="creador.php" method="post">
        <input type="text" name="datos" id="datos" />
        <input type="submit" name="formSubmit" value="Submit" />
    </form>
</body>

and the php script is also simple

$datos1=_POST("datos");

$html= aquí va la página web y en mitad de código me gustaría meter el datos1

file_put_contents('C:\xampp\htdocs\prueba2\Pagfinal.html', $html);
    
asked by Guillermo Ye 21.03.2017 в 09:14
source

1 answer

0

Taken from this answer shows you how to prepare the creador.php page to receive the variable named datos .

index.php

<head>
</head>
<body>
    <form action="creador.php" method="post">
        <input type="text" name="datos" id="datos" />
        <input type="submit" name="formSubmit" value="Submit" />
    </form>
</body>

creator.php

 <html>
 <body>

<script type="text/javascript">  

  var datos ="<?php echo $_POST['datos']; ?>";
  var ventanaHTML = window.open("about:blank", "_blank");

  ventanaHTML.document.writeln("hola! tus datos: " + datos);

</script>

 </body>
 </html> 

output

Hello! your data

answered by 21.03.2017 / 10:17
source