Novice, Pat. Ladies and gentlemen, help me see what this PHP code problem is.

Source: Internet
Author: User
Html Code:


















[/code]


PHP Code:
<title>Sales REP Maintenance</title>
 Successfully connected to MySQL.

';//mysql_close (); Close the Connection}else {die ('

Could not connect to MySQL because: '. Mysql_error (). '

');} if (@mysql_select_db ("PREMIERE", $connection)) {print '

The PREMIERE database has been selected.

';} else {die ('

Cound not select the PREMIERE database because: '. Mysql_error (). '

');} 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 ($_request[' submit '] = = "Update") {Update_rep ();} function Generate_form () {}function search_rep () {//Define the rep number php variable name$rep = $_post[' rep_num '];p rint " The rep num Chosen was $rep
";//Define The Query$query =" SELECT * from REP WHERE customer_num = ' $rep ' ";//Output The resulting query Tableif ($r = mysql_query ($query)) {while ($row = Mysql_fetch_array ($r)) {print "

{$row [' Rep_num ']}
{$row [' last_name ']}
{$row [' first_name ']}
{$row [' STREET ']}
{$row [' City ']}
{$row [' state ']}
{$row [' ZIP ']}
{$row [' COMMISSION ']}
{$row [' Rate ']}

\ n ";}}} function Add_rep () {}function delete_rep () {}function update_rep () {}?>


You can connect to the MySQL server, but you cannot display the results ...


Reply to discussion (solution)

Error_reporting (E_all & ~e_notice);
Change for
Error_reporting (E_all);
I might have known.

Change the $row key to lowercase.

Error_reporting (E_all & ~e_notice);
Change for
Error_reporting (E_all);
I might have known.

Change the $row key to lowercase.

I tried, the error message is:
Undefined index:submit ... on line 28
Undefined Index:submit ... on line 33

The 28 line is if (!$_request[' submit ') accepts the data submitted by the form
But there's no control named submit in your form.

Upstairs positive solution, give type a submit input plus name=submit

The 28 line is if (!$_request[' submit ') accepts the data submitted by the form
But there's no control named submit in your form.

How do we change that?
HTML file:

Rep Num:

Wouldn't it be possible to set the input type to "submit"?

Add a hidden input

Will




Switch





In general, the input type is set to "submit" on it. But the value of the unnamed Commit button is not committed
However, in your application, it is the value of the Commit button to determine how to operate, so be sure to name

Will




Switch

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.