0

why the hell the password matching funtion pwdCompare() is not working here ??and kindly tell me .. how to enabling the "forwarding" input box relating to radio button yes or no :( :( plz plz plz help me !!

<html>
<head>
<title>Email Control</title>
<link href="email-styles.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type = "text/javascript">

function pwdCompare() { // password matching function
var p1 = document.edit_email.password.value;
p1 = p1.replace(/^\s+/g, "");  // strip leading spaces
var p2 = document.edit_email.repassword.value;
p2 = p2.replace(/^\s+/g, "");  // strip leading spaces
if(p1 != p2)) {  
alert ("The two passwords do not match!!  Try again!");
document.edit_email.password.value = "";
document.edit_email.repassword.value = "";
document.edit_email.password.focus();
return false;
}
else {
alert ("The passwords match!");
}
}

</script>

</head>
<body>
<?php 
include("config.php"); 
?>
<table width="600" align="center">
<tr>
<td>
<form  name="edit_email" action="savedata.php" method="post">
<table width="600" border="0" cellpadding="0" cellspacing="5">
  <tr><td class="emailtext">Password</td>
    <td><label for="password"></label>
      <input type="password" name="password" id="password"></td>
  </tr>
  <tr>
    <td class="emailtext">Re-Type Password</td>
    <td><label for="repassword"></label>
      <input type="password" name="repassword" id="repassword"  onBlur="pwdCompare()"></td>
  </tr>
<tr>
    <td valign="top" bgcolor="#FFFFFF" class="emailtext">Forwarding Mails</td>
    <td bgcolor="#FFFFFF"><label>
      <input name="radiobutton" type="radio" value="yes">
      Yes</label>      

      <label>
<input name="radiobutton" type="radio" value="no"> 




      <span class="emailtext">To</span>
      <input type="text" name="forwarding" id="forwarding"></td>
  </tr>
  <tr>
<tr>
    <td colspan="2" align="center" bgcolor="#FFFFFF"><input type="submit" name="submit" id="submit" value="SAVE">
      <label>
      <input type="button" name="back" value="Back" onClick="window.location.href='index.php'">
      </label></td>
    </tr>
</table>
</form>
</td></tr>
</table>

Edited by Dani: Formatting fixed

4
Contributors
5
Replies
7
Views
7 Years
Discussion Span
Last Post by pearll
0

Use Code Tags and post only relevant code not whole bunch of it.
All I can see is JS code and this is PHP forum (wrong forum?)

0

sorry ... the closing tag of code has one slash missing ....... i dont knw how to edit now ..


and this is a php page just having one JS function ... and i have posted the only relevant codes ... the whole page has more codings !!!!!

1

Just something that stands out for me is the two end closing brackets in the if statement
you currently have this:

if(p1 != p2)) {

and you should have this?
if(p1 != p2) {

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.