日期:2014-05-17  浏览次数:20465 次

新手,轻拍. 各位大哥大姐们帮我看一下这段php代码问题出在哪
Html Code:

<html>

<head>
<body>

<form action="sales_rep_m.php" method="post"> Rep Num: <input name="rep_num" type="int">
<input type="submit" value="Search">
</form>

<form action="sales_rep_m.php" method="post"> Rep Num: <input name="rep_num" type="int">
Last Name: <input name="last_name" type="varchar"> First Name: <input name="first_name" type="varchar">
Street: <input name="street" type="varchar"> City: <input name="city" type="varchar"> 
State: <input name="state" type="varchar"> Zip: <input name="zip" type="int">
Commission: <input name="commission" type="float"> Rate: <input name="rate" type="float">
<input type="submit" value="Add">
</form>

<form action="sales_rep_m.php" method="post"> Rep Num: <input name="rep_num" type="int">
<input type="submit" value="Delete">
</form>

<form action="sales_rep_m.php" method="post"> Rep Num: <input name="rep_num" type="int">
Last Name: <input name="last_name" type="varchar"> First Name: <input name="first_name" type="varchar">
Street: <input name="street" type="varchar"> City: <input name="city" type="varchar"> 
State: <input name="state" type="varchar"> Zip: <input name="zip" type="int">
Commission: <input name="commission" type="float"> Rate: <input name="rate" type="float">
<input type="submit" value="Update">
</form>

</body>

</html>

[/code]


PHP code:

<html>
<head>
<title>Sales Rep Maintenance</title>
</head>
<?php
// Address error handling

ini_set('display_errors',1);
error_reporting(E_ALL & ~E_NOTICE);

// Attempt to Connect

if ($connection = @mysql_connect ('localhost', '***', '***')){
print '<p>Successfully connected to MySQL.</p>';
//mysql_close(); // close the connection
}
else {
die('<p>Could not connect to MySQL because: <b>' .mysql_error() .
'</b></p>');
}
if (@mysql_select_db("PREMIERE", $connection)){
print '<p>The PREMIERE database has been selected.</p>';
}
else {
die('<p>Cound not select the PREMIERE database because: <b>' .mysql_error().'</b></p>');
}

if(!$_REQUEST['submit'])
{
generate_form();
}
else if($_REQUEST['submit'] == "Search")
{
search_rep();
}
else if($_REQUEST['submit'] == "Add")
{
add_rep();
}
else if($_REQUEST['submit'] == "Delete")
{
delete_rep();
}
else if($_REQUE