Jump to content

Combination php + html?


eduard

Recommended Posts

This isn´t right! What´s wrong? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"><HTML><head><meta http-equiv="content-type" content="text/ html; charset=UTF-8"><title>Eduard Lid</title><link rel="stylesheet" type="text/css" href="ex1.css"></head><body><br><h4>Portfolio</h4><div id="idioma"><p>Chose your lenguage:</p>Seleccione su idioma:<form method="post" name="nav"><br><select name="lang" onChange="document.location.href=document.nav.lang.options[document.nav.lang.selectedIndex].value"><option value="portfolio.html" selected >English </option><option value="portfolio.html">Español </option><option value="portfolio.html">German </option><option value="portfolio.html">Dutch </option><option value="portfolio.html">French </option></select><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html lang='en' xml:lang='en' xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>database</title></head><body><form action="insert.php" method="POST"> <label for="s_name">Site Name:</label> <input type="text" id="s_name" name="site_name"/> <label for="s_url">Site URL:</label> <input type="text" id="s_url" name="site_url"/> <label for="Description">Description:</label> <input type="text" id="Description" name="Description"/> <input type="submit" value="Add Link"/></form><?php$Site_Name = $_POST['site_name'];$Site_URL = $_POST['site_url'];$Description = $_POST['Description'];$con = mysql_connect("localhost","root","usbw") or die(mysql_error());mysql_select_db("website", $con);$sql="INSERT INTO links (Site_Name, Site_URL, Description)VALUES ('$_POST[site_name]','$_POST[site_url]','$_POST[Description]')";if (!mysql_query($sql,$con)){ die('Error: ' . mysql_error());}echo "1 record added";mysql_close($con);?><?php$con = mysql_connect("localhost", "root", "usbw");mysql_select_db("website", $con);// sending query$result = mysql_query("SELECT * FROM links");echo "<h1>Table: links</h1>";echo "<table border='1'><tr>"; // printing table headers for($i=0; $i<0; $i++) { $field = mysql_fetch_field($result); echo "<td>{$field->name}</td>"; } echo "</tr>\n"; // printing table rows while($row = mysql_fetch_row($result)) { echo "<tr>"; // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($row as $cell) echo "<td>$cell</td>"; echo "</tr>\n"; } mysql_free_result($result); ?></body></html></form></div><div id="floater"><ul id="flags"> <li>eng<a href="english.html"><span id="amer"></span></a></li> <li>es<a href="spanish.html"><span id="spanish"></span></a></li> <li>d<span id="germ"></span></li> <li>nl<span id="dutc"></span></li> <li>f<span id="fren"></span></li></ul></div><!--end #floater --><div id="vertical"></div><div id="main"><p><img id="eduard" src="eduard.JPG" alt="img Eduard Lid"></p><p align="center"> <iframe width="450" height="300" src="http://www.youtube.com/embed/h2AWKgU0cN4" frameborder="0" allowfullscreen></iframe><img id="lake" src="lake.jpg" alt="img lake"></p><div id="content"><p>Web designer<span class="right">Diseñador de sitios web</span></p><p>Translator<span class="right">Traductor</span></p><ul id="links"><li><a href="english.html">more</a></li><li><a href="spanish.html">más</a></li></ul></div></div><!--end #main --><h1>Eduard Lid</h1><p id="copyright">Copyright © 2012</p></body></HTML>

  • Like 1
Link to comment
Share on other sites

Looks like it needs some work. Do you have a specific question?

Edited by niche
Link to comment
Share on other sites

why do you think it is not right? any errors?

Link to comment
Share on other sites

Why do you think I sent this topic?
i dont know,you can tell it better. if there is not any error what does make you think it is not right? how would we know what is not working as you intented, if you dont tell it?
Link to comment
Share on other sites

You put the entire code of one page inside another page. That means you have 2 doctypes, 2 <html> tags, 2 <head> sections, 2 <body> sections, etc. That's not correct. An HTML page has 1 doctype, 1 head, and 1 body. You can't just copy and paste the entire contents of one file into the middle of another file. If there are things in the head of one file that you need to move to the other, then you move those into the head of the other file. Things in the body of one file need to be moved into the body of the other file.

Link to comment
Share on other sites

You put the entire code of one page inside another page. That means you have 2 doctypes, 2 <html> tags, 2 <head> sections, 2 <body> sections, etc. That's not correct. An HTML page has 1 doctype, 1 head, and 1 body. You can't just copy and paste the entire contents of one file into the middle of another file. If there are things in the head of one file that you need to move to the other, then you move those into the head of the other file. Things in the body of one file need to be moved into the body of the other file.
Perfect reply! That´s what I needed all the time!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...