Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

help with php gui


  • Please log in to reply

#1
jackfusion

jackfusion

    New Member

  • Member
  • Pip
  • 2 posts
Hello all

I thing this is going to be very complex.

I have a Some PHP and HTML files I would like to put together but, there is things that need to happen. I forgot the MySQL database set up. I will first post the script and code for the PHP and HTML.

PHP Script

1 <html>
2 <head>
3 <title>Getting Data out of the Database</title>
4 </head>
5 <body bgcolor="#FFFFFF">
6 <h1>The Daily News</h1>
7 <!-- Order news by 
8 <a href="chapter7/chapter7/data_out.php3?orderby=date">Date</a>, 
9 <a href="chapter7/chapter7/data_out.php3?orderby=heading">Heading</a> or by 
10 <a href="chapter7/chapter7/data_out.php3?orderby=author">Author</a>. -->
11 <p>
12 <form action="list_out.php" method="POST">
13 Search:
14 <input type="text" name="Title"> 
15 <input type="submit" name="submit" value="Submit!">
16 </form>
17 <table border="1" cellpadding="3">
18 <?php
19 /* This program gets news items from the database */
20 $db = mysql_connect("localhost", "root", "c705m5p");
21 mysql_select_db("php", $db);
22 /* if ($orderby == 'date'):
23 $sql = "select * from news order by 'date'";
24 elseif ($orderby == 'author'):
25 $sql = "select * from news order by 'author_name'";
26 elseif ($orderby == 'heading'):
27 $sql = "select * from news order by 'heading'";
28 else
29 else: */
30 if (isset($submit)):
31 $sql = "select * from list where Title = '$Title'";
32 endif; 
33 $sql = "select * from list";
34 $result = mysql_query($sql);
35 while ($row = mysql_fetch_array($result)) {
36 print("<tr><td bgcolor=\"#003399\"><b>");
37 printf("<font color=\"white\">%s</font></b></td></tr>\n", 
38 $row["heading"]);
39 printf("<td>By: <a href=\"mailto:%s\">%s</a>\n", 
40 $row["author_email"], $row["author_name"]);
41 printf("<br>Posted: %s<hr>\n", 
42 $row["date"]);
43 printf("%s</td></tr>\n", 
44 $row["body"]);
45 }
46 ?>
47 </table>
48 </body>
49 </html>

HTML Code


1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
5 <title>Untitled Document</title>
6 	
7 	<style type="text/css">
8 
9 	body {
10 		behavior:url("csshover.htc");
11 	}
12	
13	* {
14		font-family:arial,tahoma,verdana,helvetica;
15		font-size:12px;
16	}
17
18	/* the menu */
19
20	ul,li,a {
21		display:block;
22		margin:0;
23		padding:0;
24		border:0;
25	}
26
27	ul {
28		width:250px;
29		border:1px solid #9d9da1;
30		background:white;
31		list-style:none;
32	}
33
34	li {
35		position:relative;
36		padding:1px;
37		z-index:9;
38	}		
39		li.folder ul {
40			position:absolute;
41			width: 160px;
42			left:250px; /* IE */
43			top:5px;
44		}
45		div#descrip
46		{
47			left:
48		}		
49			li.folder>ul { left:250px; } /* others */
50
51	a {
52		padding:2px;
53		border:1px solid white;
54		text-decoration:none;
55		color:gray;
56		font-weight:bold;
57		width:100%; /* IE */
58	}
59		li>a { width:auto; } /* others */
60
61	/* regular hovers */
62
63	a:hover {
64		border-color:gray;
65		background-color:#bbb7c7;
66		color:black;
67	}
68		li.folder a:hover {
69			background-color:#bbb7c7;
70		}
71	
72	/* hovers with specificity */
73	
74	li.folder:hover { z-index:10; }		
75		
76	ul ul, li:hover ul ul {
77		display:none;
78	}
79
80	li:hover ul, li:hover li:hover ul {
81		display:block;
82	}		
83
84	</style>
85
86 </head>
87
88 <body>
89	<ul id="menu">
90		<li class="folder">			
91		<a href="#" class="submenu"></a></li>
92		  <ul>
93			<li class="folder">&nbsp;&nbsp;See: </li>
94			  <li class="folder">
95				  &nbsp;&nbsp;Paper:  <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;See Reference</li>
96			  <li class="folder">
97				  &nbsp;&nbsp;Paper: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;See Reference</li>
98			  <li class="folder">
99				  <a href="">Online catalogue</a></li>
100			  <li class="folder">		
101				  <a href="">Full text – Online - Infotrac</a></li>
102			  <li class="folder">		
103				  <a href="">Full text – Online - CBCA</a></li>
104			  <li class="folder">&nbsp;&nbsp;Absorbed:  <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;See Reference</li>
105			  <li class="folder">&nbsp;&nbsp;ISSN: </li>
106	 </ul>
107   </li>
108	</ul>
109
110 </body>
111 </html>


The MySQL heading columns are Title, See, Page 1, Page 2, Page 3, Online Catalogue, Full Text - Online - Infotrax, Full Text - Online - CBCA, CBCA Dates, Absorbed, Microfilm, ISSN and Electronic.

What I would like to do is turn the HTML into PHP without changing the layout. I think I know a little about it where it says (on line 38 in the PHP script) $row["heading"]); I would change heading with Title and where I see $row [""]); I would put the right column name.

Here is going the be the hard part I would the script to search the different records and put the right formatting in place from the HTML code. EX: If the script search and finds See then it will only show that in the submenu or if the script find page2 online catalogue then it would only display page 2 format and online catalogue.
  • 0

Advertisements


#2
Magosis

Magosis

    Retired Staff

  • Retired Staff
  • 190 posts
Not 100% sure what you are asking here, my understanding is, you don't want to use html tags to output the site?

Edited by Magosis, 04 August 2006 - 06:20 PM.

  • 0

#3
jackfusion

jackfusion

    New Member

  • Topic Starter
  • Member
  • Pip
  • 2 posts
Sorry not clean about that I would like to put the php in to the html so when the search page returns results it will display the results in the html format. The other thing I want to do is have the php search the results and only display the right stuff in the submenu from the html. Example when the php see null in the See column the See stuff is not displayed and then it sees something in column page1 that will be displayed. ect.
  • 0

#4
Magosis

Magosis

    Retired Staff

  • Retired Staff
  • 190 posts
well for this i would recomend first having it export all information into a number of variables then using a simple

<?php 
	 if ($variable) {
		  echo $variable
	 }
?>

  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP