Jump to content

Three errors any help on either three would be appreciated


prcollin

Recommended Posts

<?php

include("connect.php");

//first check to see if user submits
[color=red]if (!isset($_POST[submit])) {[/color]
//if the submit button is not pushed, show the form
$show_form = "yes";
} elseif (isset($_POST[submit])) {
//if the submit button is pushed, check errors
if (empty($_POST[username])) {

//show the form
$show_form = "yes";
//…and so on with the errors
} else {
//after no more error checks, if user passes all
$show_success = "yes";
} //end if
} //end if  ->you can put if statements inside if statements

//if show form is true …then display it
if ($show_form == "yes") {
$display = "<center>";
$display .= "<form action = \[color=green]"$_SERVER[php_SELF][/color]\" method = \"post\">\n";
$display .= "<table border = >";

$display .= "<td align = \"right\">Company Name:</td>\n";
$display .= "<td><input type = \"text\" name = \"company_name\" size
= 20 maxlength = 50></td>\n";
$display .= "</tr>\n\n";
$display .= "<td align = \"right\">Address:</td>\n";
$display .= "<td><input type = \"text\" name = \"address\" size = 20
maxlength = 50></td>\n";
$display .= "</tr>\n\n";
$display .= "<td align = \"right\">City:</td>\n";
$display .= "<td><input type = \"text\" name = \"city\" size = 20
maxlength = 50></td>\n";
$display .= "</tr>\n\n";
$display .= "<td align = \"right\">State:</td>\n";
$display .= "<td><input type = \"text\" name = \"state\" size = 20
maxlength = 50></td>\n";
$display .= "</tr>\n\n";
$display .= "<td align = \"right\">Zip Code:</td>\n";
$display .= "<td><input type = \"text\" name = \"zip_code\" size =
20 maxlength = 50></td>\n";
$display .= "</tr>\n\n";
$display .= "<td align = \"right\">Phone Number:</td>\n";
$display .= "<td><input type = \"text\" name = \"phone\" size = 20
maxlength = 50></td>\n";
$display .= "</tr>\n\n";
$display .= "<td align = \"right\">Fax:</td>\n";
$display .= "<td><input type = \"text\" name = \"fax\" size = 20
maxlength = 50></td>\n";
$display .= "</tr>\n";
$display .= "<td align = \"right\">E-mail Address:</td>\n";
$display .= "<td><input type = \"text\" name = \"email\" size = 20
maxlength = 50></td>\n";
$display .= "</tr>\n\n";
$display .= "<td align = \"right\">Chose a User Name:</td>\n";
$display .= "<td><input type = \"text\" name = \"user_name\" size =
20 maxlength = 50></td>\n";
$display .= "</tr>\n\n";
$display .= "<td align = \"right\">Choose  A Password:</td>\n";
$display .= "<td><input type = \"password\" name = \"password\" size
= 20 maxlength = 50></td>\n";
$display .= "</tr>\n\n";
$display .= "<td align = \"right\">Re-Type Password:</td>\n";
$display .= "<td><input type = \"password\" name = \"pass2\" size =
20 maxlength = 50></td>\n";
$display .= "</tr>\n\n";
$display .= "<td align = \"right\">Type A Security Question:</td>\n";
$display .= "<td><input type = \"text\" name = \"security_question\"
size = 20 maxlength = 50></td>\n";
$display .= "</tr>\n\n";
$display .= "<td align = \"right\">Type A Security Question Answer:</td>\n";
$display .= "<td><input type = \"text\" name =
\"security_questionans\" size = 20
maxlength = 50></td>\n";
$display .= "</tr>\n\n";
$display .= "<td align = \"right\">Please Choose a Subdomain Name:</td>\n";
$display .= "<td><input type = \"text\" name = \"subdomain_choice\"
size = 20 maxlength = 50></td>\n";
$display .= "</tr>\n\n";
$display .= "<td align = \"right\">Please choose a business category:</td>\n";
$display .= "<td><input type = \"text\" name = \"category\"
size = 20 maxlength = 50></td>\n";
$display .= "<td><input type = \"submit\" name = \"submit\" value =
\"Register\"></td>\n";
$display .= "</tr>\n";
$display .= "</table>\n";
$display .= "</form>\n";
$display .= "</center>\n";
} //if

[color=red]if ($show_success == "yes") {[/color]

$company_name = ($_POST[company_name]);
$address = ($_POST[address]);
$city = ($_POST[city]);
$state = ($_POST[state]);
$zip_code = ($_POST[zip_code]);
$phone = ($_POST[phone]);
$fax = ($_POST[fax]);
$email = ($_POST[email]);
$user_name = ($_POST[user_name]);
$password = ($_POST[password]);
$pass2 = ($_POST[pass2]);
$security_question = ($_POST[sercurity_question]);
       $security_questionans = ($_POST[security_questionans]);
$subdomain_choice = ($_POST[subdomain_choice]);
$category_type = ($_POST[category]);


$query = "INSERT INTO newclients (company_name, address, city,
state, zipe_code, phone, fax, email, user_name, password,
pass2, security_question, security_questionans, sub_domain) VALUES('$company_name', '$address', '$city', '$state', '$zip_code','$phone', '$fax', '$email', '$user_name', '$password', '$pass2','$security_question','$security_questionans',
'$subdomain_choice', NOW())";

$result = mysql_query($query) or die(mysql_error());

} //end if

?>
<html>
<head>
<title>New Customer Sign Up Form</title>
</head>
<body>
<h3>New Customer Sign Up Form</h3>
<p><?php print "$display"; ?></p>

</body>
</html>

 

 

here are the errors

 

1.  Use of undefined constant submit.  assumed 'submit'

2.  Use of undefined constant Show_success

 

ok guess those are the only two how do i define them so they will do what i needd them too.  I need this form to post to a database.  SHould i take out the Php_self part also that is higlighted in green

 

 

and does anyone have any other suggestions how to get this to actually work. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.