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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:39:52+00:00 2026-05-26T16:39:52+00:00

I have the following form that I am inserting in to a database with

  • 0

I have the following form that I am inserting in to a database with a primary key called index to give them all a numerical value. What am I doing wrong that it won’t add it? It doesn’t give me an error messages at all. Thanks for the assistance!

FORM:

 <form action = "addissue.php" METHOD = "POST">
    <table>
      <tr>
    <td>Date Issue Occurred:</td>
    <!--http://www.dynamicdrive.com/dynamicindex7/jasoncalendar.htm-->
    <td><script>DateInput('orderdate', true, 'DD-MON-YYYY')</script></td>
</tr>
      <tr>
    <td>Please select the application affected:</td>
    <td><select name = "application">
        <option value = "default1">1</option>
        <option value = "2">2</option>
        </select></td>
</tr>
      <tr>
    <td>Start Time:</td>
    <td><input type = "text" name = "start" /></td>
</tr>
      <tr>
    <td>End Time:</td>
    <td><input type = "text" name = "end" /></td>
</tr>
      <tr>
    <td>Duration:</td>
    <td><input type = "text" name = "dur" /></td>
</tr>
      <tr>
    <td>Service Level Affecting?</td>
    <td><input type = "radio" name = "sla" value = "Yes" />Yes
             <input type = "radio" name = "sla" value = "No" />No</td>
</tr>
      <tr>
    <td>System State:</td>
    <td><select name = "state">
        <option value = "down">Down</option>
        <option value = "degradated">Degradated</option>
        <option value = "feature">Feature Broken</option>
        </select></td>
</tr>
      <tr>
    <td>Issue Description:</td>
    <td><textarea name = "issuedesc"rows = "5" cols = "90">Enter Issue Description Here.</textarea></td>
</tr>
      <tr>
    <td>Resolution Description:</td>
    <td><textarea name = "resdesc" rows = "5" cols = "90">Enter Resolution Description Here.</textarea></td>
</tr>
      <tr>
    <td>Group Issue Is Assigned To:</td>
    <td><select name = "group">
        <option value = "default1">1</option>
        <option value = "2">2</option>
        </select></td>
</tr>
      <tr>
    <td><input type = "submit" value = "Submit"></td>
</tr>

</table>

</form>

Addissue.php

<?php

    include('db_loginreport.php');

    $con = mysql_connect($db_host, $db_username, $db_password);

    if(!$con)
    {
        die('Could not connect: ' . mysql_error());
    }

    $db_select = mysql_select_db($db_database);

    if(!$db_select)

    {

        die("Could not select the database. <br />".mysql_error());

    }
    $date = $_POST["orderdate"];
    $app = $_POST["application"];
    $starttime = $_POST["start"];
    $endtime = $_POST["end"];
    $duration = $_POST["dur"];
    $sysstate = $_POST["state"];
    $issdesc = $_POST["issuedesc"];
    $resdesc = $_POST["resdesc"];
    $assigned = $_POST["group"];

    $query = "Insert INTO issuetrack (date, app, starttime, endtime, duration, sla, sysstate,issdesc, resdesc, assigned) 
                        VALUES ($date, $app,$starttime,$endtime,$duration,$sysstate,$issdesc,$resdesc,$assigned)";

    $result = mysql_query($query);

    if(!$result)

    {

        die("Could not query the database:  <br />".mysql_error());

    }

?>

db format:

#   Column  Type
1   index   int(11)
2   date    varchar(11)
3   app varchar(50)
4   starttime   varchar(16)
5   endtime varchar(16)
6   duration    varchar(5)
7   sla varchar(3)
8   sysstate    varchar(20)
9   issdesc varchar(2048)
10  resdesc varchar(2048)
11  assigned    varchar(30)
  • 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-05-26T16:39:52+00:00Added an answer on May 26, 2026 at 4:39 pm

    You have 2 problems. The insert fails because your variables are not enclosed in quotes as in '$date':

    $query = "Insert INTO issuetrack (date, app, starttime, endtime, duration, sla,  sysstate,issdesc, resdesc, assigned) 
                        VALUES ('$date', '$app','$starttime','$endtime','$duration','$sla','$sysstate','$issdesc','$resdesc','$assigned')";
    

    Also, note that you are missing an entry for $sla in your query. I have added it above.

    Your second problem is that your script is wide open to tampering via SQL injection.

    At a minimum, you MUST escape all of these variables with mysql_real_escape_string(), even if it is for an internal application only.

    $date = mysql_real_escape_string($_POST["orderdate"]);
    $app = mysql_real_escape_string($_POST["application"]);
    $starttime = mysql_real_escape_string($_POST["start"]);
    ...
    ...
    $resdesc = mysql_real_escape_string($_POST["resdesc"]);
    $assigned = mysql_real_escape_string($_POST["group"]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code that looks like the following: <form id=MyForm name=MyForm method=post action=index.php> <input
I have the following form which intercepts the ENTER key so that when the
I'm looking at some Java classes that have the following form: public abstract class
I have a form that takes the following inputs: Name: IBM Surface(in m^2): 9
I have an SQL query that takes the following form: UPDATE foo SET flag=true
I'm new to web programming and I have the following form that I wish
I have a registration form that is rendered by the following urlconf -- url(r'^$',
I have the following form that has 2 selects: <form id=form class=form_visitar method=post action=ajax/selects.php>
I have the following problem in ASP.NET: there is a form that contains a
I have the following form that uses a GET to pass parameters to a

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.