Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PHP programming Part 1 , you will create a form and a PHP processor for it. The

ID: 3559280 • Letter: P

Question

PHP programming

Part 1, you will create a form and a PHP processor for it.
The form will allow the user to select some styling options such as text color, font family, etc.
(Include at least 3 style attributes.) The form will also contain a text area where the user can type
a paragraph or more of text.
The form processor will use the styling selections to style the text typed in the text area and
produce a page displaying the content of the text area. For simplicity, use an embedded style
sheet to achieve this effect. The contents of this style sheet will be produced by PHP from the
submitted form data.
Use a method that avoids relying on the form values being valid style attributes. In other words,
for the form elements use your own choices for names, and then convert these to style attributes
in the PHP.
For example, instead of having a form menu option whose value is Times Roman and inserting
that value directly into the style sheet, give that option a name like times and have the PHP
convert it to "Times Roman" for the style sheet.
You can have a static HTML form and a separate PHP processor script, or an all-in-one script
that both generates the form and processes it.

Your PHP code should display a calendar page. The top of the calendar states the day and time
being displayed. The calendar is a table where the first column lists hours starting from the
current hour to a final hour (where the final hour is the current hour + some number between 0
and 12). For example, if the time is now is 3.32 pm, the first hour should read 3.00 pm and the
last hour is determined by a variable called hours_to_show. If hours_to_show is set at 12, then
the last hour shown in the column should be 3.00 pm. The subsequent columns correspond to
people. You should display a minimum of 3 or as many you prefer.


Part 2
Directions
? Please note the requirements are as follows the number of hours being displayed is set by
a variable. Therefore this variable will be set to 12 at the start, however, this means that
the number of rows in the table cannot be assumed to be known and you cannot simply
write XHTML meaning not STATIC for 12 rows.
? I have prepared a CSS file for you that you can use to style your calendar. You can get
the CSS here(Please see bellow). This is just for your convenience. You may choose to write your own CSS
if you so desire. When using my CSS file please note that certain elements need to be
given appropriate ids or classes. Please be aware to see what elements need to be given
class or id labels.

General notes
Make sure that your file has correct permissions set. php files should have permissions
set to 755 or if you prefer: -rwxr-xr-x. Which means that it should be: read for owner
group and other and write for owner and execute for owner group and other.
? For debugging purposes you can change the top line to be: #!/usr/local/bin/php -d
display_errors=STDOUT and you will get error output on your document, which makes
finding syntax errors much easier.

Requirements
? Your program should be called calendar.php and should reside in your public directory
along with a CSS file called callendar.css that styles it.
? When your program is finished, create a text file called calendar.txt and copy and paste
the contents of your calendar.php file into calendar.txt. Put calendar.txt in your public
directory as well.
? Your calendar must be generated by PHP script.
? By default when your page is loaded it should display current day, date and time.
? Your program must use a function called get_hour_string to get the hours for the first
column of the calendar table. This function takes a single argument of a timestamp and
returns a string indicating an hour. For example, the value returned might be: "8.00am".
? The table is rendered by PHP the number of rows displayed is determined by a variable
hours_to_show, which you may set equal to 12.
? The rows should alternate in background color.

CSS

Thank you in Advance.

Explanation / Answer

1.) html file

<html>

<style type="text/css">

</style>

<body>

<div id=comnt >

<div id=form >
<form name="comment" method="post" action="comment.php">
<table width="500" border="0" cellspacing="3" cellpadding="3">
<tr>
<td align="left" id="one">Name :</span></td>
<td><input type="text" name="namename" id="tnameid"></td>
</tr>
<tr>
<td align="left" id="one">Email-Id :</span></td>
<td><input type="text" name="job" id="tjobid"></td>
</tr>
<tr>
<td align="left" id="one"></td>
<td><textarea name="message" id="tmessageid"></textarea></td>
</tr>
<tr>
<td align="left" id="one"></td>
<td><input type="submit" name="submit" id="submit" value="Submit Comment"></td>
</tr>
</table>
</form>
</div>
</div>

</body>

</html>

2.) Save below file as comment.php in the same folder where you saved above html file

<?php

//database name --> db
//table name --> commentbox
//table values --> name--> varchar(20)
               // job --> varchar (25)
               // message --> varchar (250)

$conn=mysql_connect("localhost","root","");
$db=mysql_select_db("downdropcomment",$conn);

if(isset($_POST['submit']))
{
$name=$_POST['namename'];
$job=$_POST['job'];
$message=$_POST['message'];
$insert=mysql_query("insert into commentbox
(name,job,message)values
('$name','$job','$message')")or die(mysql_error());
header("Location:index.php");
}
?>