Jump to content

[SOLVED] Force a form to submit


limitphp

Recommended Posts

On my registration page, when they hit the button to register it takes them to another mode on the register page that checks all the info.

 

In other words.....register.php has a form :

<FORM NAME="frmRegister" METHOD="post" ACTION="register.php">

<INPUT TYPE="hidden" NAME="mode" VALUE="1">

 

When they click the register button mode = 1

if mode = 1 check all info to make sure its valid.

 

If it is valid, send them to verify.php and send some variables via a form.

 

Is that possible?

Right now I have another form on register.php

<FORM NAME="frmSuccess" METHOD="post" ACTION="verify.php">
<INPUT TYPE="hidden" NAME="mode" VALUE="1">
<INPUT TYPE="hidden" NAME="email" VALUE="<?php echo $email?>">	
<INPUT TYPE="hidden" NAME="username" VALUE="<?php echo $username?>">
</FORM>
[code]

When all their info checks out I try to force a submit on the above form so they will go to verify.php with all those variables
I use this javascript: document.frmSuccess.submit()

But right now it doesn't seem to work.
Am I doing something wrong?
Is my logic messed up?

Link to comment
Share on other sites

Put this in verify.php:

<?php if (isset($_POST['submit'])) {
$user = $_POST['username'];
$email = $_POST['email'];}

change register.php to this:

<FORM NAME="frmSuccess" METHOD="post" ACTION="verify.php">
<INPUT TYPE="hidden" NAME="email" VALUE="<?php echo $email?>">	
<INPUT TYPE="hidden" NAME="username" VALUE="<?php echo $username?>">
        <input type="submit" name="submit" />
</FORM>

Link to comment
Share on other sites

Put this in verify.php:

<?php if (isset($_POST['submit'])) {
$user = $_POST['username'];
$email = $_POST['email'];}

change register.php to this:

<FORM NAME="frmSuccess" METHOD="post" ACTION="verify.php">
<INPUT TYPE="hidden" NAME="email" VALUE="<?php echo $email?>">	
<INPUT TYPE="hidden" NAME="username" VALUE="<?php echo $username?>">
        <input type="submit" name="submit" />
</FORM>

 

I tried adding the <input type="submit" name="submit" /> and it still didn't work.

 

I'm thinking its not submiting the form because the as the page loads, it gets to the javascript where it says document.frmSuccess.submit()

but the page hasn't finished loading and the form frmSuccess doesn't exist yet.

 

Is there anyway to fix this problem?

How can I dely the javascript: document.frmSuccess.submit() until after the page loads?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.