Skewled Posted March 30, 2011 Share Posted March 30, 2011 ugh... nope, still doesn't work. It doesn't insert first and last names and it still comes up with no content. elaborate on what no content comes up. Read over the comments I placed in the code also because you have a $_GET['step'] that I had no clue where the information was coming from... Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194109 Share on other sites More sharing options...
Skewled Posted March 30, 2011 Share Posted March 30, 2011 Humor me and change on both forms: I don't see any case/switch or if/else statments to deal with action=login, and since we're not using GET variables step=1 ..etc isn't needed. action="index.php?action=login&step=1" to: action="index.php" Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194112 Share on other sites More sharing options...
adamlacombe Posted March 30, 2011 Author Share Posted March 30, 2011 like it just shows header and footer, no page content. (aka middle content) if(!$_GET['step'] && $_POST['newpassword']){ GET step and POST newpassword is so we know were talking about signup and not login. There is signup and login in the same file. Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194113 Share on other sites More sharing options...
adamlacombe Posted March 30, 2011 Author Share Posted March 30, 2011 did what you said to do, switch the forms to index.php and it did what it was supposed to, go to index.php lol Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194116 Share on other sites More sharing options...
Skewled Posted March 30, 2011 Share Posted March 30, 2011 like it just shows header and footer, no page content. (aka middle content) if(!$_GET['step'] && $_POST['newpassword']){ GET step and POST newpassword is so we know were talking about signup and not login. There is signup and login in the same file. Ah I didn't see any require's or includes for signup and login in that script. if(!$_GET['step'] && $_POST['newpassword']){ should be: if((!empty($_GET['step']) && ($_POST['newpassword'])) { Isn't it suppose to go back to index.php? Did your changes get made? ALSO: add error_reporting(E_ALL); to the begining of the script after <?php just to show some errors we may not see Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194117 Share on other sites More sharing options...
adamlacombe Posted March 30, 2011 Author Share Posted March 30, 2011 index.php holds a switch, action. action=login includes login.php so if you go to index.php?action=login it will bring you to what the code I posted is. Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194119 Share on other sites More sharing options...
adamlacombe Posted March 30, 2011 Author Share Posted March 30, 2011 now that I changed it to this: if((!empty($_GET['step']) && ($_POST['newpassword'])) { it gives me a blank page like I explained Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194120 Share on other sites More sharing options...
Skewled Posted March 30, 2011 Share Posted March 30, 2011 okay so action="index.php?action=login" and my last edit was: error_reporting(E_ALL); add this to the script below <?php tag so we can spot errors Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194121 Share on other sites More sharing options...
adamlacombe Posted March 30, 2011 Author Share Posted March 30, 2011 Notice: Undefined index: id in /home/gamersgo/public_html/datingsnap.com/header.php on line 33 Notice: Undefined index: id in /home/gamersgo/public_html/datingsnap.com/header.php on line 36 Notice: Undefined variable: pre2 in /home/gamersgo/public_html/datingsnap.com/includes/functions.php on line 39 Notice: Undefined variable: pre2 in /home/gamersgo/public_html/datingsnap.com/includes/functions.php on line 39 Thats all I got for errors... nothing to do with login.php Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194124 Share on other sites More sharing options...
Skewled Posted March 30, 2011 Share Posted March 30, 2011 now that I changed it to this: if((!empty($_GET['step']) && ($_POST['newpassword'])) { it gives me a blank page like I explained Change to: if ((!empty($_GET['step']) && (!empty($_POST['newpassword']))) { also make sure you adjust the form actions.. See what that gives you.. Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194126 Share on other sites More sharing options...
adamlacombe Posted March 30, 2011 Author Share Posted March 30, 2011 just get this error: Parse error: syntax error, unexpected '{' in /home/gamersgo/public_html/datingsnap.com/pages/login.php on line 48 which makes no sense cuz there needs to be that { Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194127 Share on other sites More sharing options...
Skewled Posted March 30, 2011 Share Posted March 30, 2011 What's on line 48? if ((!empty($_GET['step']) && (!empty($_POST['newpassword']))) {? Try: if ((!empty($_GET['step'])) && (!empty($_POST['newpassword']))) { It's probably a syntax error it's near 3am here and I'm not really up to par for this, I must apoligize I was hoping to help you solve your issue but I've not had much luck with that. Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194129 Share on other sites More sharing options...
adamlacombe Posted March 30, 2011 Author Share Posted March 30, 2011 yup its the if ((!empty($_GET['step'])) && (!empty($_POST['newpassword']))) { same error is there though. and its alright, I appreciate the effort. and you're right it is almost 3am lol no wonder im sleepy. How about we both get some rest and we will work on this tomorrow morning. sound good? Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194130 Share on other sites More sharing options...
Skewled Posted March 30, 2011 Share Posted March 30, 2011 I'll do what I can have a busy day tomorrow, but will drop in to see if this is resolved. Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194132 Share on other sites More sharing options...
adamlacombe Posted March 30, 2011 Author Share Posted March 30, 2011 Alright thanks man. have a goodnight Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194136 Share on other sites More sharing options...
adamlacombe Posted March 30, 2011 Author Share Posted March 30, 2011 Does anyone else have any ideas as to why the $_POST['email'] isn't passing down the steps? Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194341 Share on other sites More sharing options...
Psycho Posted March 30, 2011 Share Posted March 30, 2011 @adamlacombe, you are never going to get anywhere if you don't lear how to properly debug code. Instead of just saying something doesn't work, you need to test the input/output at key steps to ascertain where the problem is. In this case the first thing you should have done was do a print_r($_POST) on the page when it is submitted. You would have seen that $_POST['email'] is getting passed with the literal value of "$email" - NOT the value you assigned to the variable $email. You are writing your hidden field within a single quoted string echo '<table width="100%"><form method="post" action="index.php?action=login&step=2"> <input id="email" type="hidden" name="email" value="$email"> <tr> Variables are NOT interpreted within single quoted strings. To be honest, your code really needs to be cleaned up. There is a ton of duplicity and no logical flow. Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194358 Share on other sites More sharing options...
adamlacombe Posted March 30, 2011 Author Share Posted March 30, 2011 I already had that fixed, I realized that after looking over it again that I needed to change it to '.$email.' Still it does not pass down to step number 1. and well I try my best to code but I still am learning. Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194368 Share on other sites More sharing options...
Psycho Posted March 30, 2011 Share Posted March 30, 2011 Have you done a print_r($_POST) at the top of the page to validate what is being sent in the post data? If it does contain the value then you test the value of $email after setting it with clean_up(), and so on... Like I was saying, your code is very unorganized which makes debuggin much harder than it should be. FOr example, at the top of the page you are setting variables using the post data: $user = clean_up($_POST['email']); $pass = clean_up($_POST['password']); But, then you do the exact same thing with the same POST values in several places in the code. If you've already set the variables you need, there is not reason to set them again. Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194377 Share on other sites More sharing options...
adamlacombe Posted March 30, 2011 Author Share Posted March 30, 2011 I get this: Array ( => adamlacombe2012@yahoo.com [first] => John [last] => Smith [submit1] => Next step ) So thats after I submit the form with first and last name. It brings me to step one. Nothing in step one (where bdate will be submitted) i shown, no form at all. Also first and last name isn't updated where email=$email Yeah I understand that. Ill remove them. Just had doubles because I was mostly copying things from an older file I had. Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194380 Share on other sites More sharing options...
Psycho Posted March 30, 2011 Share Posted March 30, 2011 OK, now look at the data passed in the POST data and look at the core logic of your page and determine what should happen. Here is the last submission you made with your full code. I took out the "details" of the code and just left the branching structure (i.e. the IF/ELSE statements. I also added comments as to how that post data you just posted would be interpreted by your current logic. <?php $title="Login"; $metakeywords="login, email"; $metadescription="Login to Dating Snap!"; include('header.php'); $email = clean_up($_POST['email']); $pass = clean_up($_POST['password']); if($user && $pass) { //$_POST['password'] was not in the POST data //So this whole branch will not be executed } else { if(!$_GET['step'] && $_POST['newpassword']) { //$_POST['newpassword'] was not in the POST data //So this whole branch will not be executed } //end if email } include('footer.php'); ?> Based upon the code you previously posted and the results of the POST values sent to the page, nothing should happen. Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194385 Share on other sites More sharing options...
adamlacombe Posted March 30, 2011 Author Share Posted March 30, 2011 Wow I feel quite dumb now lol I looked at the code and changed one if statement and everything works now! Thank u so much Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194386 Share on other sites More sharing options...
Skewled Posted March 30, 2011 Share Posted March 30, 2011 Checking back as promised glad to see your up and running. Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194407 Share on other sites More sharing options...
raptor30506090 Posted March 30, 2011 Share Posted March 30, 2011 sorry about this but were do you start your own post i have a problem....... Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194423 Share on other sites More sharing options...
Psycho Posted March 30, 2011 Share Posted March 30, 2011 Select the forum you want to post in and then select the "New Topic" link. Quote Link to comment https://forums.phpfreaks.com/topic/232125-passing-_post/page/2/#findComment-1194425 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.