Jump to content

Does not post


rdkd1970

Recommended Posts

Okay I had a trial form that always added to my db now I copied the same codes just added it to my site and does not post anything. Can someone tell me why it is not working now after so many trials of success. When nothing has changed but the added information like pictures and normal things on my pages.

 

It is supposed to go to my registration-success.php but it just picks up the connecting php to insert to the db and leaves it blank.

Link to comment
Share on other sites

Okay I had a trial form that always added to my db now I copied the same codes just added it to my site and does not post anything. Can someone tell me why it is not working now after so many trials of success. When nothing has changed but the added information like pictures and normal things on my pages.

 

It is supposed to go to my registration-success.php but it just picks up the connecting php to insert to the db and leaves it blank.

 

it worked locally but not on the live site? check the connection details

Link to comment
Share on other sites

I put the code and this is what shows up after I add information to the form.

text

text

text

 

 

All my connections are correct nothing changed I test live with the codes and now I added my same codes that I test live to my index page that has the same form info but with the designs. When I tested the codes that worked it was just the form and the php info that connected to the db and inserted etc.

Link to comment
Share on other sites

session_start();

$garbage = 'just some bs <ul><li>text</li><li>text</li><li>text</li></ul>just some more bs';
preg_match_all('/<ul>(.*?)<\/ul>/i', $garbage, $matches);
echo $matches[0][0];

include_once ("Connections/connect_to_mysql.php"); 

  $err='';
  $username='';
  $password='';
  $firstname='';
  $lastname='';
  $email='';
  $gender='';
  $looking_for='';
  $birth_date='';
  $maritalStatus='';
  $children='';
  $wantChildren='';
  $ethnic='';
  $education='';
  $country='';
  $bestfriend='';
  $humanCheck='';

  if(isset($_POST["submit"])){

  
    // Validate form data

    if($_POST["firstname"]=='') $err.='Please enter First Name<br>';
    if($_POST["email"]=='') $err.='Please enter Email<br>';



    if($err==''){ 

      // Check if there are duplicate entries in the 'contacts' table

      $sql_check = mysql_query("SELECT id FROM `Members` WHERE username='".addslashes($_POST["username"])."' and firstname='".addslashes($_POST["firstname"])."' and Email='".addslashes($_POST["email"])."'");
      if($row = mysql_fetch_array($sql_check)){
        $err.='Can not add duplicate entry<br>';
      }
      else{

        // adding new record to 'contacts' table

       $results = mysql_query("INSERT INTO Members (username,password,firstname,lastname,email,gender,looking_for,birth_date,
   				maritalStatus,children,wantChildren,ethnic,education,country,bestfriend) 
                    values ('".mysql_real_escape_string($_POST["username"])."','".md5($_POST["password"])."','".mysql_real_escape_string($_POST["firstname"])."','".mysql_real_escape_string($_POST["lastname"])."','".mysql_real_escape_string($_POST["email"])."','".mysql_real_escape_string($_POST["gender"])."','".mysql_real_escape_string($_POST["looking_for"])."','".mysql_real_escape_string($_POST["birth_date"])."','".mysql_real_escape_string($_POST["maritalStatus"])."','".mysql_real_escape_string($_POST["children"])."','".mysql_real_escape_string($_POST["wantChildren"])."','".mysql_real_escape_string($_POST["ethnic"])."','".mysql_real_escape_string($_POST["education"])."','".mysql_real_escape_string($_POST["country"])."','".mysql_real_escape_string($_POST["bestfriend"])."')")
				or die (mysql_error());
$id = mysql_insert_id();
$userid = mysql_insert_id();
$_SESSION['id']= $userid; 

       // redirecting to success screen
   if($results){
         header("Location: register-success.php");
}else
die(mysql_error());

      }
    }
  }

 

The rest is the form and the html info. which is how it is gone crazy i guess.

Link to comment
Share on other sites

I entered into the form. I have the form going to the register.php which if successful will go to register-success.php. It goes to register.php and does nothing does not add to the db.

 

I used the same coding with a form only and got the results I needed it went to success then let me go to login to the profile page.

 

Now it just stops at register.php with a blank page.

Link to comment
Share on other sites

You know what I did. I just deleted the login form which I had on my index.php with the registration form put in a link to login. Ran the codes for the registration page on index.php and got it to work. so that means for some reason the confusion is with the two forms on the same page. Thanks for all the help.

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.