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

  • Home
  • SEARCH
  • 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 9204225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:39:38+00:00 2026-06-17T23:39:38+00:00

The following is my code, in which I have 2 text boxes named fyear

  • 0

The following is my code, in which I have 2 text boxes named fyear and ayear. This code is not working, as, I am unable to connect it with the MySQL database. What might be the problem and how could I overcome it? I’m using PHP:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Home</title>
</head>



<body style="background-color:#708090;">

<?php

if (isset($_POST['submit']))
{

    $mysqli= new mysqli("localhost","admin","admin", "nba" );

    if($mysqli === false)
    {
        die("could not connect:" . mysqli_connect_error());
    }

    if ($inputError != true && empty($_POST['ayear']) )
    {
        echo 'ERROR: Please enter a valid year';
        $inputError = true;
    }
    else
    {
        $ayear = $mysqli-> escape_string($_POST['ayear']);
    }

    if ($inputError != true && empty($_POST['fyear']) )
    {
        echo 'ERROR: Please enter a valid year';
        $inputError = true;
    }
    else
    {
        $fyear = $mysqli->  escape_string($_POST['fyear']);
    }   

    if ($inputError != true)
    {
        $sql="INSERT INTO year VALUES ('$ayear','$fyear')";
        if ($mysqli-> query($sql)==true)
        {
            echo'Added';
        }
        else
        {
            echo"ERROR: Could not execute query : $sql. " . $mysqli-> error;
        }
    }

    $mysqli-> close();

}
?> 







<h1 style="font-family:Verdana;text-align:center;">National Board of Accrediation <br>of<br> Master of Computer Applications Programme</h1>
<br>

<div id="menu" style="background-color:#800000;height:25px;width:1000px">
<b><font "style="font-family:Verdana"><a href="part1.html" title="Institutional Summary"style="color: #000000">Part I</a>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<a href="part2.html"title="Departmental/Program Summary"style="color: #000000">Part II</a>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<a href="part3.html"title="Curricula,Syllabi,PEOs and POs"style="color: #000000">Part III</a>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<a href="part4.html" title="List of Documents to be made available during the visit"style="color: #000000">Part IV</a></font></b>
</div>


<form   method="post" action="home.php"> <p> This  Report  is prepared for the Current Acadamic Year(<input type="text" size="9"  name="ayear" id="ayear" onChange="a('ayear');">) and the Current Financial Year (<input type="text" size="9"  name="fyear" id="fyear" onChange="a('fyear');">) on behalf of the Institution.</p>



<input type="submit" name="submit" value="Submit"/>
</form>
</body>
</html>

The problem is from this part:

else
        {
            $ayear = $mysqli-> escape_string($_POST['ayear']);
        }

After the “>” symbol, everything is getting printed in the web page. What could be the possible solution for this? I’ve gone through this code but couldn’t find out what the mistake is.

  • 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-17T23:39:40+00:00Added an answer on June 17, 2026 at 11:39 pm

    PHP did not process your script at all, so that <?php ... -> was interpreted as a HTML tag. Look at the HTML source code in your browser.

    Is the script saved as .php? Is PHP installed on your server?

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

Sidebar

Related Questions

I have the following code which is working, I was wondering if this can
I have the following code which should be getting the text from a span
I have progress.js file which has the following code $('#text_area_input').keyup(function() { var text_area_box =$(this).val();//Get
I have written Following code which will apply color to all static text in
I have the following code which searches a text file on my phone's sd
I have the following code which works fine to format text from an SQL
Hello I have the following code which uses knockout.js, var allJobberDetailsArray = []; getAllJobberDetailsArray();
I currently have the following code which delays showing a fixed bar after a
So I have the following code which is doing a setInterval until the iframe
I have the following code which definitely returns a proper data result if I

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.