473,508 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

print "...."; Question

I am wandering if my code is making sense... I use a lot the print function.
Is it weird in this case where I have to display an array ? I thought it
would be better to have the entire array in php but now I am not sure if
that makes sense. Can you tell me please ?
<html>

<head>

<link href="../withStyle.css" rel="stylesheet" type="text/css">

<title>Reporting System Demand Management</title>
</head>

<body>
<center><h1>Add request</h1></p></center>
<hr>

<p align="center">
&nbsp;

<?php

print "<form ACTION='..' method='POST'>";
print "<table border='1' width='45%'>";
print "<tr>";
print "<td align='left' width='50%' height='25'>";
print "<p align='left'>Request Name</p>";
print "</td>";
print "<td align='left' width='50%' height='25' colspan='2'>
<p align='left'><input type='text' size='40'
name='request_name'><img src='requis.gif' width='15' height='15'></p>";
print "</td>";
print "</tr>";
print "<tr>";
print "<td align='left' width='50%' height='25'>";
print "<p align='left'>Request Date</p>";
print "</td>";
print "<td align='left' width='50%' height='25' colspan='2'>";
print "<p align='left'>";
print "<select name='day'>";
print "<option selected>dd</option>";
print "<option>01</option>";
print "<option>02</option>";
print "<option>03</option>";
print "<option>04</option>";
print "<option>05</option>";
print "<option>06</option>";
print "<option>07</option>";
print "<option>08</option>";
print "<option>09</option>";
print "<option>10</option>";
print "<option>11</option>";
print "<option>12</option>";
print "<option>13</option>";
print "<option>14</option>";
print "<option>15</option>";
print "<option>16</option>";
print "<option>17</option>";
print "<option>18</option>";
print "<option>19</option>";
print "<option>20</option>";
print "<option>21</option>";
print "<option>22</option>";
print "<option>23</option>";
print "<option>24</option>";
print "<option>25</option>";
print "<option>26</option>";
print "<option>27</option>";
print "<option>28</option>";
print "<option>29</option>";
print "<option>30</option>";
print "<option>31</option>";
print "</select>";
print "<select name='month'>";
print "<option selected>mm</option>";
print "<option>01</option>";
print "<option>02</option>";
print "<option>03</option>";
print "<option>04</option>";
print "<option>05</option>";
print "<option>06</option>";
print "<option>07</option>";
print "<option>08</option>";
print "<option>09</option>";
print "<option>10</option>";
print "<option>11</option>";
print "<option>12</option>";
print "</select>";
print "<select name='year'>";
print "<option selected>aaaa</option>";
print "<option>2006</option>";
print "<option>2007</option>";
print "<option>2008</option>";
print "<option>2009</option>";
print "<option>2010</option>";
print "<option>2011</option>";
print "<option>2012</option>";
print "<option>2013</option>";
print "<option>2014</option>";
print "<option>2015</option>";
print "<option>2016</option>";
print "<option>2017</option>";
print "<option>2018</option>";
print "<option>2019</option>";
print "<option>2020</option>";
print "</select><img src='requis.gif' width='15' height='15'>";
print "</p>";
print "</td>";
print "</tr>";
print "<tr>";
print "<td align='left' width='50%' height='25'>";
print "<p align='left'>Client Name</p>";
print "</td>";
print "<td align='left' width='50%' height='25' colspan='2'>";
print "<p align='left'>";
print "<select name='Client_name' size='1'>";
print "<option>Name</option>";

//connexion
$c1=oci_connect("stephane","Stef1975",$bdtest05);

$query="select client_firstname||' '||client_lastname as client_fullname
from clients";

$stmt=oci_parse($c1,$query);

oci_execute($stmt);

while ($row = oci_fetch_array($stmt,OCI_NUM))
{
print "<option>";
echo $row[0];
print "</option>";
}

oci_free_statement($stmt);

print "</select><img src='requis.gif' width='15' height='15'></p>";
print "</td>";
print "</tr>";
print "<tr>";
print "<td align='left' width='50%' height='25'>";
print "<p align='left'>Request Type</p>";
print "</td>";
print "<td align='left' width='50%' height='25' colspan='2'>";
print "<p align='left'>";
print "<select name='Request Type' size='1'>";
print "<option>Request Type</option>";

$query="select request_type_name from request_types";

$stmt=oci_parse($c1,$query);

oci_execute($stmt);

while ($row = oci_fetch_array($stmt,OCI_NUM))
{
print "<option>";
echo $row[0];
print "</option>";
}

oci_free_statement($stmt);
print "</select><img src='requis.gif' width='15' height='15'>";
print "</p>";
print "</td>";
print "</tr>";
print "<tr>";
print "<td align='left' width='50%' height='25'>";
print "<p align='left'>Client Departement</p>";
print "</td>";
print "<td align='left' width='50%' height='25' colspan='2'>";
print "<p align='left'>";
print "<select name='Department' size='1'>";
print "<option>Departement</option>";

$query="select department_name from departments";

$stmt=oci_parse($c1,$query);

oci_execute($stmt);

while ($row = oci_fetch_array($stmt,OCI_NUM))
{
print "<option>";
echo $row[0];
print "</option>";
}

oci_free_statement($stmt);

print "</select>";
print "</p>";
print "</td>";
print "</tr>";
print "<tr>";
print "<td align='left' width='50%' height='25'>";
print "<p align='left'>Expected Delivery Date</p>";
print "</td>";
print "<td align='left' width='50%' height='25' colspan='2'>";
print "<p align='left'>";
print "<select name='day'>";
print "<option selected>dd</option>";
print "<option>01</option>";
print "<option>02</option>";
print "<option>03</option>";
print "<option>04</option>";
print "<option>05</option>";
print "<option>06</option>";
print "<option>07</option>";
print "<option>08</option>";
print "<option>09</option>";
print "<option>10</option>";
print "<option>11</option>";
print "<option>12</option>";
print "<option>13</option>";
print "<option>14</option>";
print "<option>15</option>";
print "<option>16</option>";
print "<option>17</option>";
print "<option>18</option>";
print "<option>19</option>";
print "<option>20</option>";
print "<option>21</option>";
print "<option>22</option>";
print "<option>23</option>";
print "<option>24</option>";
print "<option>25</option>";
print "<option>26</option>";
print "<option>27</option>";
print "<option>28</option>";
print "<option>29</option>";
print "<option>30</option>";
print "<option>31</option>";
print"</select>";
print "<select name='month'>";
print "<option selected>mm</option>";
print "<option>01</option>";
print "<option>02</option>";
print "<option>03</option>";
print "<option>04</option>";
print "<option>05</option>";
print "<option>06</option>";
print "<option>07</option>";
print "<option>08</option>";
print "<option>09</option>";
print "<option>10</option>";
print "<option>11</option>";
print "<option>12</option>";
print "</select>";
print "<select name='year'>";
print "<option selected>aaaa</option>";
print "<option>2006</option>";
print "<option>2007</option>";
print "<option>2008</option>";
print "<option>2009</option>";
print "<option>2010</option>";
print "<option>2011</option>";
print "<option>2012</option>";
print "<option>2013</option>";
print "<option>2014</option>";
print "<option>2015</option>";
print "<option>2016</option>";
print "<option>2017</option>";
print "<option>2018</option>";
print "<option>2019</option>";
print "<option>2020</option>";
print "</select>";
print "</p>";
print "</td>";
print "</tr>";
print "<tr>";
print "<td align='left' width='50%' height='25'>";
print "<p align='left'>Comment on Request</p>";
print "</td>";
print "<td align='left' width='50%' height='25' colspan='2'><textarea
name=comment cols=30 rows=2></textarea><p>";
print "</td>";
print "</tr>";
print "<tr>";
print "<td align='left' width='50%' height='25'>";
print "<p align='left'></td>";
print "<td align='left' width='25%' height='25'>";
print "<p align='left'><input type='submit' name='addButton'
value='Add Request'>";
print "</p>";
print "</td>";
print "<td align='left' width='25%' height='25'>";
print "<input type='reset' name='resetButton' value='Reset'>";
print "</td>";
print "</tr>";
print "</table>";
print "</form>";

//close connexion
oci_close($c1);

?>

<p align="left"></p>
<hr>
<p align="center"><a href="index.htm">[Home]</a></p>
</body>

</html>

// thanks for looking!
Mar 19 '06 #1
1 2310
Steff wrote:
I am wandering if my code is making sense... I use a lot the print function.
Is it weird in this case where I have to display an array ? I thought it
would be better to have the entire array in php but now I am not sure if
that makes sense. Can you tell me please ?

<code snipped>
// thanks for looking!

It's all a matter of style. Personally, I don't use print for straight
HTML - I just code the HTML and go into PHP when I need it. Exceptions
are things like quick elements.

A quick look at your code (and I might have missed something) and it
looks like nothing before the connexion line requires PHP. So why even
have PHP there? Just code it as HTML.

Your while loop fetching the rows I would have similar, except I'd code
it as:

while ($row = oci_fetch_array($stmt,OCI_NUM))
{
echo "<option>" . $row[0] . "</option>";
}

You don't need two print statements and an echo here.

Again, you have a bunch of print statements following this which are
just displaying HTML code - no PHP variables, etc. So why even
complicate things by using PHP? Just do the straight HTML code.

And so on.

The bottom line is - my first order of business is coding clarity. When
you have a lot of just HTML code, it complicates matters to put them in
print or echo statements. It takes longer to process as PHP than it
does to just output the straight html. So why do it?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 19 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1536
by: Anthony Liu | last post by:
We know that if we do print '\a' the bell will sound. Now, why do I hear the sound on my local machine when I run a python script on a remote host? I understand if I hear it when I do
8
3332
by: Tony | last post by:
Hello I am learning C# and encountered the following problem when I tried to figure out how to print the string {0} in a Console window The following piece of codes complied OK. But when I...
5
1868
by: Paul Sullivan | last post by:
We are a state agency that views protected medical information via our intranet. The screens even have privacy shields. Alarmingly, uses can "Print" and "Save As" which destroys the protection of...
0
951
by: Jeremy L. Moles | last post by:
I have an object (written as part C extension, part pure Python) called foo that I've been using without much fuss for a few months now. However, in my latest project (a rather large one involving...
13
10289
by: ATJaguarX | last post by:
I have a Zebra S500 and multiple S600 label printers. http://www.zebra.com/id/zebra/na/en/index/products/printers/industrial_commercial/s600.html They are currently being used in our legacy...
1
4942
by: Appu | last post by:
How to Check in the window print dialog box whether we clicked either "print" or "cancel". while clicking a button i call wnidow.print() to pop up the windows PRint Dialog box. I want to check...
45
9041
by: Umesh | last post by:
please help. thanks.
10
1574
by: Prisoner at War | last post by:
Hi, your friendly neighborhood n00b here, just wondering why on earth the Py3K folks want to mess with a simple thing like the "print" "command" (is that what it's called, a command?), turning it...
3
4872
by: Cameron Simpson | last post by:
On 18Aug2008 11:58, Beema Shafreen <beema.shafreen@gmail.comwrote: | In my script i have to print a series of string , so | | print "%s\t%s\t%s\t%s\t%s\t%s\t" %("a","v","t","R","s","f") | | I...
0
7342
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7067
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5650
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4729
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
440
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.