[jQuery] Login Script with SimpleModal
Hello. I am currently using Eric Martin's SimpleModal dialog to try
and create a login script without leaving the main page. Right now,
the script will load fine, however, when I click login, it does not
validate the form elements to make sure they were filled out and it
does not process the results or display them to the modal box when
clicked. What it actually does - is display all of the form elements
(user name and password) in the url of the page the modal box is
overlaying.
http://www.example.com/index.php?email=testemail@test.com&password=password
I am using the contact form example, but changed the email, message,
and and name fields to email and password. Other than that, I haven't
really changed much of the code. I am kind of a newbie when it comes
to jQuery and javascript, but I am really trying to learn it so I can
use this helpful (and light weight) plugin in the future. If someone
wants to take a look, and perhaps tell me what I messed up, I'd
appreciate it!
Link to the JS: http://www.wizmatic.com/contact.js
Here is the PHP:
<?php
$extra = array(
'ip' => TRUE,
'user_agent' => TRUE
);
// Process
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
if (empty($action)) {
// Send back the contact form HTML
echo "<div style='display:none'>
<!--<a href='#' title='Close' class='modalCloseX modalClose'>x</a>-->
<div class='contact-top'></div>
<div class='contact-content'>
<div class='contact-content'>
<h1 class='contact-title'></h1>
<div class='contact-loading' style='display:none'></div>
<div class='contact-message' style='display:none'></div>
<form action='#' style='display:none' name='login'>
<label for='email'>Email Address:</label>
<input type='text' id='contact-email' class='contact-input'
name='email' tabindex='1001' />
<label for='password'>Password:</label>
<input type='password' id='contact-password' class='contact-input'
name='password' tabindex='1002' />
<br />
<div style='width:390px;text-align:center;margin-top:3px;'><a
href='register.php' class='contact-link'>Register</a> | <a href='#'
class='contact-link'>Forgot your password?</a></div>
<div style='position:relative;left:140px;top:6px;'>
<button type='submit' class='contact-send contact-button'
tabindex='1004' name='login_btn'>Login</button>
<button type='submit' class='contact-cancel contact-button
modalClose' tabindex='1005'>Cancel</button>
</div>
<br/>
</form>
</div>
<div class='contact-bottom'></div>
</div>";
} else if ($action == 'send') {
$email = isset($_REQUEST['email']) ? $_REQUEST['email'] : '';
$pass = isset($_REQUEST['password']) ? $_REQUEST['password'] : '';
echo "done";
}
exit;
?>