Good day!

Ive been working with fancy box login and now Im almost at the point to accomplish it.
I want to get the login username and password from the array that fancy box was created..

The main task is to pass the login username and password value from login page(login.php) to members_accnt.php and save it to a session variable..

Heres the code I used to echo the login username and password to make sure it exist from the user who login.This code is on members_accnt.php.

<?php session_start(); ?>

<?php 
echo print_r($_POST);  
?>

Now i get this result in members_accnt.php..

Array ( [login_name] => admin [login_pass] => admin ) 1

Here goes the problem, I want to extract the value for login_name to be stored in session variable as well as the password..

Here's the code that loads the div with a form which holds the username text box and password followed by the fancy box syntax.

<!-- MEMBERS LOGIN POPUP --> 
 
    <div class="style24" style="display:none">

	<form id="login_form" method="POST" action="" name="memlogin">
    
      <p id="login_error">Enter your User Name & Password...</p>
        
		
			<label for="login_name">Enter User Name: </label>
			<br><input type="text" id="login_name" name="login_name" size="40" /></br>
	 
        
		<p>
			<label for="login_pass">Enter Password: </label>
			<br><input type="password" id="login_pass" name="login_pass" size="40" /></br>
	  </p>
        
		<p>
			<input type="submit" value="Login" />
	   </p>
        
		<p>
		    <em>( Chat Admin to ask for User Name & Password )</em>	  </p>
	</form>
</div>


<!-- LOADING MEMBERS LOGIN DIV TO POPUP WITH FANCY BOX--> 
 
<script type="text/javascript">
$(document).ready(function() {
   $("#popup").fancybox({
    'scrolling'		: 'no',
    'titleShow'		: false,
    'transitionIn'      : 'elastic',
    'transitionOut'     : 'fade',
    'onClosed'		: function() {
	$("#login_error").hide();
	}
  });
 });
$("#login_form").bind("submit", function() {

	if ($("#login_name").val().length < 1 || $("#login_pass").val().length < 1) {
	    $("#login_error").show();
	    $.fancybox.resize();
	    return false;
	}

	$.fancybox.showActivity();

	$.ajax({
		type		: "POST",
		cache		: false,
		url		: "members_accnt.php",
		data		: $(this).serializeArray(),
		success		: function(data) {
				$.fancybox(data);
		}
	});

	return false;
});

 </script>

Thank you for helping!

Recommended Answers

All 2 Replies

I think you mean this:

$_SESSION['login_name'] = $_POST['login_name'];
$_SESSION['login_pass'] = $_POST['login_pass'];

Ive figure this out also...

Thank you twiss for helping.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.