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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T21:53:30+00:00 2026-06-18T21:53:30+00:00

I would like to insert datetime stamp into a variable once the if-condition is

  • 0

I would like to insert datetime stamp into a variable once the if-condition is satisfied. But I get the following error:

Notice: Undefined index: status in C:\wamp\www\business\edit_log_widget.php on line 55

The following is the php code:

<?php
    include 'scripts/init.php';
    include 'html/header.php';
    $page = 'servers';

    $id =$_SESSION['logid'];
    $query = "SELECT *FROM log WHERE logid = $id";
    $query_submit = mysql_query($query) or die(mysql_error);
    $row = mysql_fetch_assoc($query_submit);
?>

<div class="article">
    <h2><span>Edit Logs</span></h2>
    <div class="clr"></div>
    <form action="" method="POST" >
    <p>
        <table border="0">
            <tr>
                <td><label for="Task Name">Task Name:*</label></td>
                <td><input type="text" name="task_name" size="45" value="<?php echo $row['task_name'] ?>"/></td>
            </tr>
            <tr>
                <td><label for="description">Problem Description:*</label></td>
                <td><textarea name="description" cols="33" rows="10" ><?php echo $row['description'] ?></textarea></td>
           </tr>
           <tr>
                <td><label for="solution">Solution Description:*</label></td>
                <td><textarea name="solution" cols="33" rows="10" ><?php echo $row['solution'] ?></textarea></td>
           </tr>
           <tr>
                <td><label for="status">Status:*</label></td>
                <td>
                    <select id="Select2" name="status">
                        <option>-Select-</option>
                        <option>Resolved</option>
                        <option>Un-resolved</option>
                        <option>In-Progress</option>
                    </select>
                </td>
           </tr>
        </table>
    </p>
    <p>
        <td><input id="Submit" type="submit" value="Submit" /></td>
        <td><input id ="Clear and Restart" type ="reset" value= "Clear and Restart" /></td>
    </p>
    <?php 
        if($_POST['status']== 'Resolved')
        {
            $today = DateTime::createFromFormat('!Y-m-d',date('Y-m-d')); // This is Line 55
        }

        if(isset($_GET['success']) && empty($_GET['sucess']))
        {
            echo 'the log has been captured';
        }
        else
        {
            if(empty($_POST) === false && empty($errors)=== true)
            {
                //Update Log details
                $update_log = array(
                                'task_name'=>$_POST['task_name'],
                                'description' => $_POST['description'],
                                'solution' =>$_POST['solution'],
                                'status'=>$_POST['status'],
                                'closed_date'=>$today,
                                'userid' =>$_SESSION['userid']);
                update_log($update_log);
                //redirect
                header('Location: edit_log_widget.php?success');
                exit();
            }
            else if(empty($errors) === false)
            {
                //output errors if the errors array is not empty
                echo output($errors);
            }
        }
    ?>
    </form>  
    <?php
        include 'html/side_menu.php';
        include 'html/footer.php';
    ?>

Update: edit_log.php.

<?php
    include 'scripts/init.php';
    include 'html/header.php';
    $page = 'servers';

    $id = $_GET['logid'];
    $_SESSION['logid'] = $id;
    $query = "SELECT *FROM log WHERE logid = $id";
    $query_submit = mysql_query($query) or die(mysql_error);
    $row = mysql_fetch_assoc($query_submit);
?>

<div class="article">
    <h2><span>Edit Logs</span></h2>
    <div class="clr"></div>
    <form action="edit_log_widget.php" method="POST" >
    <p>
        <table border="0">
            <tr>
                <td><label for="Task Name">Task Name:*</label></td>
                <td><input type="text" name="task_name" size="45" value="<?php echo $row['task_name'] ?>"/></td>
            </tr>
            <tr>
                <td><label for="description">Problem Description:*</label></td>
                <td><textarea name="description" cols="33" rows="10" ><?php echo $row['description'] ?></textarea></td>
            </tr>
            <tr>
                <td><label for="solution">Solution Description:*</label></td>
                <td><textarea name="solution" cols="33" rows="10" ><?php echo $row['solution'] ?></textarea></td>
            </tr>
            <tr>
                <td><label for="status">Status:*</label></td>
                <td>
                    <select id="Select2" name="status">
                        <option>-Select-</option>
                        <option value="Resolved">Resolved</option>
                        <option value="Un-resolved">Un-resolved</option>
                        <option value="In-Progress">In-Progress</option>
                    </select>
                </td>
            </tr>
        </table>
    </p>
    <p>
        <td><input id="Submit" type="submit" value="Submit" /></td>
        <td><input id ="Clear and Restart" type ="reset" value= "Clear and Restart" /></td>
    </p>
</form>  
<?php
    include 'html/side_menu.php';
    include 'html/footer.php';
?>
  • 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-18T21:53:31+00:00Added an answer on June 18, 2026 at 9:53 pm

    I moved all the php to the top of the html form and now it works fine. Thanks guys for trying to help me out

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

Sidebar

Related Questions

I would like to insert the output of multiple calculations into my text document:
I would like to insert a new DataGridViewRow into my DataGridView at a specific
I would like to know how to insert TIME into SQL Server using C#
I would like to insert in a datetime field the date of tomorrow +
I would like to insert the current Subversion revision number (as reported by svnversion
I would like to insert dates in an emacs buffer like I do in
I would like to insert notes on the fixes to be done in specific
In a part of my website I would like to insert some images and
I have a little problem where I would like to insert a svn diff
I have a JPA project and I would like to insert some initial data

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.