Jump to content

Passing $_POST


adamlacombe

Recommended Posts

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

Link to comment
Share on other sites

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"

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

yup its the if ((!empty($_GET['step'])) && (!empty($_POST['newpassword']))) {

 

same error is there though. and its alright, I appreciate the effort.  :o 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?

Link to comment
Share on other sites

@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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

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.