Hello guys,

I have googled info about this but I always see a different solution. And there are always people commenting that the solution is not correct. Here is the problem:

I have a script called "script1.php" and I would like to send data to another script called "script2.php" using the POST method. But I'm NOT sending the data with a form. Please take a look at the example code below of script1.php. Any one know how I can do this?

PHP Code:
<?php
// script1.php
if (isset($_POST['submit']))
   {
   
// check to see if data is valid
   
if (....) {echo "Data is NOT valid";}
   
// data is valid, send data to SCRIPT2.PHP with POST and run script2.php
   
else {
        
// ???????????????
        
}
   }
else {
      
?>
      <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
      Field 1: <input type="text" name="field1" value="">
      Field 2: <input type="text" name="field2" value="">
      Field 3: <input type="text" name="field3" value="">
      <input type="submit" name="submit" value="Submit">
      </form>
      <?php 
      
}
?>