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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:55:31+00:00 2026-06-13T22:55:31+00:00

Can someone show me how I would add a date automatically upon submit to

  • 0

Can someone show me how I would add a date automatically upon submit to this page? The DB id is “table1” and the feild id is “date”.

My code:

<?php

if (isset($_POST["submit"]) && $_POST["submit"] == "Submit")
{
    for ($count = 1; $count <= 9; $count++)
    {
        $fields[$count] = "";
        if (isset($_POST["field" . $count . ""]))
        {
            $fields[$count] = trim($_POST["field" . $count . ""]);
            //echo $fields[$count] . "<br />";
        }
    }

    $con = mysql_connect("local", "user", "pass");
    mysql_select_db("DB", $con);

    $carriername = mysql_real_escape_string($_POST['carriername']);
    $fromzip = mysql_real_escape_string($_POST['fromzip']);
    $tozip = mysql_real_escape_string($_POST['tozip']);
    $typeofequipment = mysql_real_escape_string($_POST['typeofequipment']);
    $weight = mysql_real_escape_string($_POST['weight']);
    $length = mysql_real_escape_string($_POST['length']);
    $paymentamount = mysql_real_escape_string($_POST['paymentamount']);
    $contactperson = mysql_real_escape_string($_POST['contactperson']);
    $loadtype = mysql_real_escape_string($_POST['loadtype']);

    $insert = "INSERT INTO table1 (`carriername` ,`fromzip` ,`tozip` ,`typeofequipment` ,`weight` ,`length` ,`paymentamount` ,`contactperson` ,`loadtype`) VALUES('$carriername' ,'$fromzip' ,'$tozip' ,'$typeofequipment' ,'$weight' ,'$length' ,'$paymentamount' ,'$contactperson' ,'$loadtype');";
    mysql_query($insert) or die(mysql_error());

    $select = "SELECT `carriername` ,`fromzip` ,`tozip` ,`typeofequipment` ,`weight` ,`length` ,`paymentamount` ,`contactperson` ,`loadtype` FROM `table1` ORDER BY `paymentamount` DESC;";
    $result = mysql_query($select) or die(mysql_error());
}
?>
</script>
<style ="text-align: center; margin-left: auto; margin-right: auto;"></style>
</head>
<body>
<div
 style="border: 2px solid rgb(0, 0, 0); margin: 16px 20px 20px; width: 400px; background-color: rgb(236, 233, 216); text-align: center; float: left;">
<form action="" method="post";">
  <div
  style="margin: 8px auto auto; width: 300px; font-family: arial; text-align: left;"><br>
  <table style="font-weight: normal; width: 100%; font-size: 12px;"
 border="1" bordercolor="#929087" cellpadding="6" cellspacing="0">
   <table
 style="font-weight: normal; width: 100%; text-align: right; font-size: 12px;"
 border="1" bordercolor="#929087" cellpadding="6" cellspacing="0">
    <tbody>
    <tr>
    <td style="width: 10%;">Carrier:</td><td>
 <?php  

$con = mysql_connect("local", "user", "pass");
    mysql_select_db("DB", $con);

$query=("SELECT * FROM table2"); 

$result=mysql_query($query) or die ("Unable to Make the Query:" . mysql_error() ); 
echo "<select name=carriername>";   

while($row=mysql_fetch_array($result)){  

echo "<OPTION VALUE=".$row['carriername'].">".$row['carriername']."</OPTION>"; 
} 

echo "</select>";  


?>
              </td>
        </tr>
        <tr>
              <td style="width: 35%;">Pick Zip:</td><td> <input id="fromzip" name="fromzip" maxlength="50"
 style="width: 100%;" type="text">
        </tr>
        <tr>
              <td style="width: 35%;">Drop Zip:</td><td> <input id="tozip" name="tozip" maxlength="50"
 style="width: 100%;" type="text">
        </tr>
        <tr>
              <td style="width: 35%;">Load Type:</td><td> <input id="loadtype" name="loadtype" maxlength="50"
 style="width: 100%;" type="text">
        </tr>
        <tr>
              <td style="width: 35%;">Rate:</td><td> <input id="paymentamount" name="paymentamount" maxlength="50"
 style="width: 100%;" type="text">
        </tr>
          </tbody>
  </table>
  <p style="text-align: center;"><input name="submit" value="Submit"
 class="submit" type="submit"></p>
  </div>
</form>
</div>
<p style="margin-bottom: -20px;">&nbsp;</p>
</body>
  • 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-13T22:55:31+00:00Added an answer on June 13, 2026 at 10:55 pm

    If you are updating your table anyway, you can do something as simple as using NOW(). An example of this would be:

    UPDATE table1 SET date=NOW()
    

    Make sure your field date is type DATETIME if you go this route. You can also use TIMESTAMP to update the field whenever the entry is edited. To create this, just create a column and set the data type to TIMESTAMP:

    CREATE TABLE test (
        last_edited TIMESTAMP 0 ON UPDATE CURRENT_TIMESTAMP
    );
    

    This will create a table (test) and one column (last_edited) and set the default value to 0. Whenever this record is edited in any fashion, the column last_edited will be updated with the time and date.

    Check out this link for a little more information: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html

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

Sidebar

Related Questions

Here is my Processing code. If someone can show me how to add either
Can someone show me how to use the System.Numerics.BigInteger datatype? I tried using this
can someone please show me documentation on this method? i have the following line:
Can someone tell/show me how to use PHP inside PHP. I'm trying to make
Given the example below, can someone please show me how this could be called?
Can someone please tell me why this doesn't work? I'm trying to show and
I'm hoping someone can modify my code below to show me exactly how to
can someone give the C# equivalent of this xamle code? <ListBox Width=400 Margin=10 ItemsSource={Binding
Can someone show me how to print the ListView contents with the ColumnHeaders, without
Can someone please explain how Read/Show works.. I cannot find any tutorials on it.

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.