Jump to content

i need help


doforumda

Recommended Posts

hi all

 

i have a problem with the date function.

 

i created two pages one posts.html and other one is posts.php the logged in user will type title and post but will not type todays date and time, the php code should sutomatically take posts' date and time. so i dont know how to do it i need help for this problem.

 

thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/120807-i-need-help/
Share on other sites

While I'm not going to hold your hand entirely, here's a large hint:

 

$timeToday = strtotime("today");
echo date('l, F dS - Y h:i:sA', $timeToday);

 

I urge you to look up the date() function:

http://us2.php.net/manual/en/function.date.php

 

as well as strtotime()

http://us2.php.net/manual/en/function.strtotime.php

 

There are a vast array of options with time and time setups.. this should help you get started.

 

Cheers,

 

NRG

Link to comment
https://forums.phpfreaks.com/topic/120807-i-need-help/#findComment-622715
Share on other sites

i have already study the functions in php.net site but couldnt get any help

can you tell me where can i place the code you provided me in post.html my post.html page is below

 

<!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">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Untitled Document</title>

<style type="text/css">

<!--

.style1 {font-size: 10px}

.style2 {font-size: 18px}

.style3 {font-size: 36px}

.style4 {font-size: 24px}

-->

</style>

</head>

 

<body>

<form id="form1" name="form1" method="post" action="posts.php">

  <table width="200" border="0">

    <tr>

      <td><span class="style4">

        <label for="title"><strong>Title</strong></label>

      </span></td>

    </tr>

    <tr>

      <td><input name="title" type="text" id="title" size="30" maxlength="150" /></td>

    </tr>

    <tr>

      <td> </td>

    </tr>

    <tr>

      <td><span class="style1"> <span class="style2"> <span class="style3"> <span class="style4">

        <label for="body"><strong>Body</strong></label>

      </span> </span> </span> </span></td>

    </tr>

    <tr>

      <td><textarea name="body" id="body" cols="45" rows="5"></textarea></td>

    </tr>

    <tr>

      <td><input name = "post[user_id]" value = "1" type = "hidden"></td>

    </tr>

    <tr>

      <td><label for="submit"></label>

        <div align="right">

          <input type="submit" name="submit" id="submit" value="Add Post" />

      </div></td>

    </tr>

  </table>

</form>

</body>

</html>

 

Link to comment
https://forums.phpfreaks.com/topic/120807-i-need-help/#findComment-622717
Share on other sites

I have not yet learned mySQL or any other databases.

If no one is willing to code this part for you, I would suggest educating yourself by looking up tutorials on such matters. Then once you are familiar with having PHP interface with a database, you can save your date along with any other information you need.

Link to comment
https://forums.phpfreaks.com/topic/120807-i-need-help/#findComment-623016
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.