Jump to content

[SOLVED] Submit form automatically???


tqla

Recommended Posts

Hello. Is it possible to have a php form submit to the form processor script automatically without needing to hit the submit button?

 

Wait, this is not as weird as it sounds!

 

A form gets filled out and then the user clicks submit. The form then gets sent to another script (below) that does a little bit to the POST data (Sessions, Implode, etc) and then puts the POST data into hidden fields to be sent it off to the form processor (register.php).

 

The problem is that the user will need to hit Submit again. I don't want that. I want it to sent the new POST data automatically.

 

<?php
session_start();
?>
<html>
<head>
<title>Untitled Document</title>
</head>

<body>
<?php

$_SESSION['FirstName'] = $_POST['FirstName'];
$_SESSION['LastName'] = $_POST['LastName'];
$_SESSION['Email'] = $_POST['Email'];
$_SESSION['Custom1'] = $_POST['Custom1'];
$_SESSION['Custom2'] = $_POST['Custom2'];
$_SESSION['Address'] = $_POST['Address'];
$_SESSION['City'] = $_POST['City'];
$_SESSION['State'] = $_POST['State'];
$_SESSION['Zip'] = $_POST['Zip'];
$_SESSION['Country'] = $_POST['Country'];
$_SESSION['Phone'] = $_POST['Phone'];
$_SESSION['Custom3'] = $_POST['Custom3'];
$_SESSION['Custom4'] = $_POST['Custom4'];
$_SESSION['Custom5'] = $_POST['Custom5'];
$_SESSION['ClientNum'] = $_POST['ClientNum'];
$_SESSION['Join_List'] = $_POST['Join_List'];

$info = implode(', ',$Custom5);

?>
<form name="form1" method="post" action="register.php " >
<input name="FirstName" type="hidden" value="<?php echo $FirstName ?>" />
<input name="LastName" type="hidden" value="<?php echo $lastName ?>" />
<input name="Email" type="hidden" value="<?php echo $Email ?>" />
<input name="Custom1" type="hidden" value="<?php echo $Custom1 ?>" />
<input name="Custom2" type="hidden" value="<?php echo $Custom2 ?>" />
<input name="Address" type="hidden" value="<?php echo $Address ?>" />
<input name="City" type="hidden" value="<?php echo $City ?>" />
<input name="State" type="hidden" value="<?php echo $State ?>" />
<input name="Zip" type="hidden" value="<?php echo $Zip ?>" />
<input name="Country" type="hidden" value="<?php echo $Country ?>" />
<input name="Phone" type="hidden" value="<?php echo $Phone ?>" />
<input name="Custom3" type="hidden" value="<?php echo $Custom3 ?>" />
<input name="Custom4" type="hidden" value="<?php echo $Custom4 ?>" />
<input name="Custom5" type="hidden" value="<?php echo $value ?>" />
<input name="ClientNum" type="hidden" value="<?php echo $ClientNum ?>" />
<input name="Join_List" type="hidden" value="<?php echo $Join_List ?>" />
<input type="submit" name="Join List" value="Join List">
</form>
</body>

Link to comment
https://forums.phpfreaks.com/topic/124403-solved-submit-form-automatically/
Share on other sites

Garethp I ended up using a javascript method similar to the one you posted.

 

DarkWater, I have no access to the resister.php page so I cannot modify it. I can only send it $_POST's, also the implode function the only thing that made this form necessary in the first place.

 

Thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.