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 8524069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:35:12+00:00 2026-06-11T07:35:12+00:00

I have PHP query to a MSSQL Database. It Looks like this: <?php if

  • 0

I have PHP query to a MSSQL Database. It Looks like this:

<?php 

    if (isset($_POST['form6'])) {
        $Title=$_POST['Title'];
        $Synopsis=$_POST['Synopsis'];
        $Article=$_POST['Article'];
        $DateUploaded= date("Y-m-d H:i:s");
        $Deleted=$_POST['Deleted'];

        $myServer = "**********";
        $myUser = "**********";
        $myPass = "******";
        $myDB = "*********";

        $dbhandle = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer"); 
        mssql_select_db($myDB) or die;

        $dbTABLE = "Tablename";
        $query_sql = sprintf("INSERT INTO %s (Title, Synopsis, Article, DateUploaded, Deleted)   VALUES ('%s','%s','%s','%s','%s')",
        addslashes($dbTABLE),
        addslashes($Title),
        addslashes($Synopsis),
        addslashes($Article),
        addslashes($DateUploaded),
        addslashes($Deleted));

        if ($result = mssql_query($query_sql, $dbhandle)) {
            print "Your information has been successfully added to the database.";
            header('Location: News.php');
        }
    }
?>

Originally it was on a seperate .php file and got executed on the ‘action’ of the form. However to lessen the amount of redirects I moved it to the same page as the form and included that if statement at the top, to try and get it to execute on post of the form, which is named form6.

here is the form line.:

<FORM method="post" name="form6" id="form6" ENCTYPE="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>">

However all this seems to do is refesh the page, and no data is addded to the database and it does not hit the header to redirect to News.php.

I also tried it with no action, same result. My question is why doesn’ this make it hit the php function/query?

  • 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-11T07:35:14+00:00Added an answer on June 11, 2026 at 7:35 am

    You are checking the <form element which never actually has values in it in the line:

    if (isset($_POST['form6']))
    

    You need to check the actual form elements (inputs) to see if data is sent.

    You should be checking the actual values in the likes of $_POST['Title'] to see if data has been sent from the form.

    If you want to include the form name, use a hidden field like this inside the form:

    <input type='hidden' name='form6' value='1'>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this PHP code to highlight the Query on search results. if (isset($_REQUEST['k'])){
I'm creating an equipment reservation (PHP/MySQL) for my school. My database looks like this:
I have two tables in a database that looks like this members table1 id
I need a database for this: <?php if (isset($_POST['addcontentbox'])) { // Connection to Database
I have the following mysql query which I am running with php like so.
So i have this script: <?php $query = mysql_query( SELECT meetup AS text, id
i have ajax function that looks like this: jQuery.ajax({ type: 'POST', data: { action:
So I have a MySQL table that looks something like this: id timestamp action
I have a MySQL database that looks similar to this: ID Group Name 1
I have a PHP document that query's a MYSQL database based on the input

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.