Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8441033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:27:35+00:00 2026-06-10T08:27:35+00:00

Now before we begin let me inform you all that this is just a

  • 0

Now before we begin let me inform you all that this is just a school assignment and that I am not overly an expert in php and sql coding.

I have the problem, whenever I execute the script, I receive the following error:

Notice: Undefined variable: Team in
C:\xampp\htdocs\NFL\searchmatches.php on line 30.

From my understanding, there would be a spelling error in the link up between the script and the form file, but I can’t seem to find the problem.

This is a file to search the database:
Script:

 <?php
    mysql_connect("localhost","root","0gd1d0wgpg") or die(mysql_error());
    mysql_select_db("NFL") or die(mysql_error());
    $query=mysql_query("SELECT * FROM Matches where Team ='$Team'") or die(mysql_error());
    $numfields = mysql_num_fields($query);
    print("<table border=\"1\">\n<tr>\n");
    for ($i=0; $i<$numfields; $i++) {
      printf("<th>%s</th>\n", mysql_field_name($query,$i));
    }
    print("</tr>\n");
    while ($row = mysql_fetch_row($query)) {
      print("<tr>\n");
      for ($i=0; $i<sizeof($row); $i++) {
         printf("<td>%s</td>\n", $row[$i]);
      }
      print("</tr>\n");
    }
    print("</table>\n");
    ?>

Form:

<form name="addmatch" method="post" action="searchmatches.php">
Search for the match history of a particular team here.<br>
<br>
Team Name: <input type="text" name="Team_Name" value="Team Name">
<br>
<br>
<input type="submit" value="Search">
</form>

Yes there is more coding in the actual files but I figured that, the PHP would be all you needed to help me.

So could somebody please tell me how rid of this error and make the search work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:27:36+00:00Added an answer on June 10, 2026 at 8:27 am

    PHP uses a special “super global” to give you access to submitted form values. The $_POST superglobal is an array with keys that match the name attribute of the form elements (when the form is submitted with the “post” method). Add this line:

    $Team = mysql_real_escape_string($_POST['Team_Name']);
    

    above the use of $Team in the query.

    To recap, the ‘Team_Name’ identifier comes from your HTML:

    <input type="text" name="Team_Name" value="Team Name">
    

    and then when the form is submitted, whatever you put in that form control is available at $_POST['Team_Name']. I passed the value through the “escape” function so to protect your query from going bonkers (or worse) if that value happened to contain special characters.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Now I have something that I have not seen it before: the database is
Before I begin, I should probably mention that this sort of thing should probably
Third try at fixing this tonight - trying a different approach than before now.
Let's say I have my vision and now my product backlog of items. That
Before I begin, I would like to state that I KNOW the Apple Guidelines
Total newbie at cronjobs and that kinda stuff, never done it before, so now
I've been having a strange problem that I've never seen before. Now I have
Before I begin, my reason for not using OAuth is I believe it is
Before I begin let me apologize for my nearly nonexistent knowledge of programing for
I would like to turn everyone's attention to this question before I begin as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.