0

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!

Edited by blocker: n/a

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by blocker
0

I think you mean this:

$_SESSION['login_name'] = $_POST['login_name'];
$_SESSION['login_pass'] = $_POST['login_pass'];
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.