about2flip
Technical User
Newbie PHP programmer on board here. I want practicing on forms and this one is giving me a headache. I want this form to let the user know when they did not fill in a field. When all fields are done I want it to go to a verify page (verify.php), & show the user what they put into the form.
I need to know will the error code post to the same page, and why I keep getting a Parsing Error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING (line 31)
Any help will be highly appreciated. Thanks AGAIN For all your help Here.
<?php
print'
<html>
<head>
</head>
<body>
$userform= <form method="post" action="verify.php">
<strong>First Name:</strong><input type="text" name="first_name" value="' . $_POST['first_name'] . '" size="30"><br>
<strong>Last Name:</strong><input type="text" name="last_name" value="' . $_POST['last_name'] . '" size="30"><br>
<strong>Email:</strong><input type="text" name="email" value="' . $_POST['email'] . '" size="30"><br>
<input type="hidden" name="op" value="ds">
<input type="submit" name="submit" value="Send Information">
</form>';
if($_POST['op'] !='ds')
{
//they need to see the form
echo $userform;
}
else
{
//check value of $_POST[first_name]
if($_POST['first_name']==")
{
$firstname_err='<font color='red'>Please enter your name!</font>';
$send='no';
}
//check value of $_POST[last_name]
if($_POST['last_name']==")
{
$lastname_err='<font color='red'>Please enter your last name!</font>';
$send='no';
}
//check value of $_POST['email']
if($_POST['email']==")
{
$email_err='<font color='red'>Please enter your email address!</font>';
$send='no';
}
if($send !='no')
{
}
else
{
echo $name_err;
echo $lastname_err;
echo $email_err;
}
print'
</html></body>
?>
I need to know will the error code post to the same page, and why I keep getting a Parsing Error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING (line 31)
Any help will be highly appreciated. Thanks AGAIN For all your help Here.
<?php
print'
<html>
<head>
</head>
<body>
$userform= <form method="post" action="verify.php">
<strong>First Name:</strong><input type="text" name="first_name" value="' . $_POST['first_name'] . '" size="30"><br>
<strong>Last Name:</strong><input type="text" name="last_name" value="' . $_POST['last_name'] . '" size="30"><br>
<strong>Email:</strong><input type="text" name="email" value="' . $_POST['email'] . '" size="30"><br>
<input type="hidden" name="op" value="ds">
<input type="submit" name="submit" value="Send Information">
</form>';
if($_POST['op'] !='ds')
{
//they need to see the form
echo $userform;
}
else
{
//check value of $_POST[first_name]
if($_POST['first_name']==")
{
$firstname_err='<font color='red'>Please enter your name!</font>';
$send='no';
}
//check value of $_POST[last_name]
if($_POST['last_name']==")
{
$lastname_err='<font color='red'>Please enter your last name!</font>';
$send='no';
}
//check value of $_POST['email']
if($_POST['email']==")
{
$email_err='<font color='red'>Please enter your email address!</font>';
$send='no';
}
if($send !='no')
{
}
else
{
echo $name_err;
echo $lastname_err;
echo $email_err;
}
print'
</html></body>
?>