<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<body background="querybackground.jpg">
<p> </p>
<p> </p>
<p> </p>
<p style="font-family:times; color:black; font-size:20px; text-align:center">CUSTOMER LOGIN</p>
<p style= text-align:"center">
<?php
function validateOnSubmit()
{
$errs= True;
if (strlen($Ctrid) < 6 || strlen($Ctrid) > 12 && $Ctrid != NULL)
{
$errs = False;
echo "alert('Please enter user id of length greater than or equal to 6 characters and less than or equal to 12 characters')";
}
if (strlen($pwd) < 6 || strlen($pwd) > 12 && $pwd != NULL)
{
$errs = False;
echo "alert('Please enter password of length greater than or equal to 6 characters and less than or equal to 12 characters')";
}
if ($Ctrid == NULL && $pwd == NULL)
{
$errs = False;
echo "alert('Please fill the required categories before submitting')";
}
return $errs;
}
echo "<form name="translation_login_input" onsubmit="return validateOnSubmit()" action="translationorder.htm" method="get">
<table>
<tr>
<td><p style="font-family:times; color:black; font-size:20px; text-align:center">Customer id</p></td>
<td><p style="font-family:times; color:black; font-size:20px; text-align:center">:</p></td>
<td><input $Ctrid type="text" name="Customerid" value="" size="20">
<br></td>
</tr>
<tr>
<td><p style="font-family:times; color:black; font-size:20px; text-align:center">Password</p></td>
<td><p style="font-family:times; color:black; font-size:20px; text-align:center">:</p></td>
<td><input $pwd type="password" name="Password" value="" size="20">
<br></td>
</tr>
</table>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>
</p>
<p style="font-family:times; color:black; font-size:20px; text-align:center">If you are a new customer, <a href="newcustomerlogin.htm">please follow this link...</a></p>
"
?>
</body>
</html>
NOTE: It shows the following error: "PHP Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in F:\Kandarp\testing\DEASICREATIONSWEBSITE\translationlogin.php on line 30 " PLEASE HELP
user login script problem
Moderator: General Moderators
Re: user login script problem
Please wrap your code using the php or code tags..
your problem is here:
you can either end the php tag or you can use the correct quotation with the echo quotations.
Example..
or you could use the following where you end the php tag before you print out the HTML
your problem is here:
Code: Select all
echo "<form name="translation_login_input" onsubmit="return validateOnSubmit()" action="translationorder.htm" method="get">
<table>
<tr>
<td><p style="font-family:times; color:black; font-size:20px; text-align:center">Customer id</p></td>
<td><p style="font-family:times; color:black; font-size:20px; text-align:center">:</p></td>
<td><input $Ctrid type="text" name="Customerid" value="" size="20">
<br></td>
</tr>
<tr>
<td><p style="font-family:times; color:black; font-size:20px; text-align:center">Password</p></td>
<td><p style="font-family:times; color:black; font-size:20px; text-align:center">:</p></td>
<td><input $pwd type="password" name="Password" value="" size="20">
<br></td>
</tr>
</table>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>
</p>
<p style="font-family:times; color:black; font-size:20px; text-align:center">If you are a new customer, <a href="newcustomerlogin.htm">please follow this link...</a></p>
"Example..
Code: Select all
echo "<form name='translation_login_input' onsubmit='return validateOnSubmit()' action='translationorder.htm' method='get'>"; // correct
echo '<form name="translation_login_input" onsubmit="return validateOnSubmit()" action="translationorder.htm" method="get">'; // correct
echo "<form name="translation_login_input" onsubmit="return validateOnSubmit()" action="translationorder.htm" method="get">"; // incorrect
Code: Select all
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<body background="querybackground.jpg">
<p> </p>
<p> </p>
<p> </p>
<p style="font-family:times; color:black; font-size:20px; text-align:center">CUSTOMER LOGIN</p>
<p style= text-align:"center">
<?php
function validateOnSubmit()
{
$errs= True;
if (strlen($Ctrid) < 6 || strlen($Ctrid) > 12 && $Ctrid != NULL)
{
$errs = False;
echo "alert('Please enter user id of length greater than or equal to 6 characters and less than or equal to 12 characters')";
}
if (strlen($pwd) < 6 || strlen($pwd) > 12 && $pwd != NULL)
{
$errs = False;
echo "alert('Please enter password of length greater than or equal to 6 characters and less than or equal to 12 characters')";
}
if ($Ctrid == NULL && $pwd == NULL)
{
$errs = False;
echo "alert('Please fill the required categories before submitting')";
}
return $errs;
}
?>
<form name="translation_login_input" onsubmit="return validateOnSubmit()" action="translationorder.htm" method="get">
<table>
<tr>
<td><p style="font-family:times; color:black; font-size:20px; text-align:center">Customer id</p></td>
<td><p style="font-family:times; color:black; font-size:20px; text-align:center">:</p></td>
<td><input type="text" name="Customerid" value="" size="20">
<br></td>
</tr>
<tr>
<td><p style="font-family:times; color:black; font-size:20px; text-align:center">Password</p></td>
<td><p style="font-family:times; color:black; font-size:20px; text-align:center">:</p></td>
<td><input type="password" name="Password" value="" size="20">
<br></td>
</tr>
</table>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>
</p>
<p style="font-family:times; color:black; font-size:20px; text-align:center">If you are a new customer, <a href="newcustomerlogin.htm">please follow this link...</a></p>
</body>
</html>