limitphp Posted December 12, 2008 Share Posted December 12, 2008 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? Quote Link to comment Share on other sites More sharing options...
limitphp Posted December 12, 2008 Author Share Posted December 12, 2008 This might come up, but I'd rather goto the verify page via a form submit instead of doing a location.href and passing the variables via a querystring....for the simple fact that I really do not want the average user to see any of the variables. Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted December 12, 2008 Share Posted December 12, 2008 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> Quote Link to comment Share on other sites More sharing options...
limitphp Posted December 12, 2008 Author Share Posted December 12, 2008 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? Quote Link to comment Share on other sites More sharing options...
limitphp Posted December 12, 2008 Author Share Posted December 12, 2008 Actually, I tried changing the javascript to window.onload = document.frmSuccess.submit() it still didn't work. Maybe I'm doing that wrong? Quote Link to comment Share on other sites More sharing options...
limitphp Posted December 12, 2008 Author Share Posted December 12, 2008 Is there anyway to send variables from 1 php page to another without using a querystring? Quote Link to comment Share on other sites More sharing options...
elite_prodigy Posted December 12, 2008 Share Posted December 12, 2008 Yes session_start(); $_SESSION['username'] = $username; //etcetera, etcetera Quote Link to comment Share on other sites More sharing options...
limitphp Posted December 12, 2008 Author Share Posted December 12, 2008 Yes session_start(); $_SESSION['username'] = $username; //etcetera, etcetera would using cookies be less taxing on the server? Quote Link to comment Share on other sites More sharing options...
limitphp Posted December 12, 2008 Author Share Posted December 12, 2008 screw it....I'm gonna use location.replace and send the stuff via a querystring. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.