PHP - Trouble With Floating Css
I'm currently in the middle of rewriting my website and have run into a little trouble.
When floating the unordered list to the right, the span no longer displays inline, despite having the unordered list's display to "inline".
Here's an image to show you what I mean:
Here's the markup:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <head> <title>Matthew Noskiw's website</title> <link rel='stylesheet' type='text/css' href='./inc/CSS/styles/default.css' /> <link rel='stylesheet' type='text/css' href='./inc/CSS/static/navigation.css' /> </head> <body> <div id='Container'> <div id='Header'> <div style='float: right'> <ul id='Navigation'> <li id='NavButton' class='active'><a href='./'>Home</a></li> <li id='NavButton'><a href='./about'>About</a></li> <li id='NavButton'><a href='./blog'>Blog</a></li> <li id='NavButton'><a href='./contact'>Contact</a></li> </ul> </div> <span>noskiw.co.uk</span> </div> </div> </body> </html>Specifically, this section: <div id='Container'> <div id='Header'> <div style='float: right'> <ul id='Navigation'> <li id='NavButton' class='active'><a href='./'>Home</a></li> <li id='NavButton'><a href='./about'>About</a></li> <li id='NavButton'><a href='./blog'>Blog</a></li> <li id='NavButton'><a href='./contact'>Contact</a></li> </ul> </div> <span>noskiw.co.uk</span> </div> </div>And here is the CSS: body { font-family: arial; font-size: 14px; color: #000000; } #Container { width: 800px; border: 1px solid #000000; margin: 0 auto; padding: 3px; } #Header { overflow: hidden; border: 1px solid #000000; padding: 5px; }Any help will be appreciated, thanks. Similar TutorialsHi All, I created this simple function to generate random doubles..... Please your opinions! function GetRandomFloatNumber($min = false, $max = false, $dec_min = false, $dec_max = false) { // Seed the generator mt_srand((double)microtime()*1000000); // Set the default min and max if no parameter has been passed if ($min === false) $min = 0; if ($max === false) $max = mt_getrandmax(); if ($dec_min === false) $dec_min = 0; if ($dec_max === false) $dec_max = mt_getrandmax(); // units $units = mt_rand($min, $max); // Decimals $decimals = mt_rand($dec_min, $dec_max); // Set double $doublenumber = $units.'.'.$decimals; // Return double return $doublenumber; } Hello everyone, I am new to this forum and PHP world. Doing my first project, a pretty complicated one to start with. I will be needing your help a lot to accomplish it. Here is the first one. 1. I have a certain field called 'country' 2. I have small flag icons for every country. WHAT DO I WANT TO DO? Example - If the country is U.S.A., the U.S. flag shows up and is a link to www.domain.com/usa If the country is Germany, the German flags shows up and is a link to www.domain.com/germany If the country is not set, no flag shows up. END. How do I execute this? This is what I am doing to get the image <img src="images/flags/<?php echo $row_rsPilots['country']; ?>.gif" alt="" name="Flag" width="20" height="20" id="Flag" /> How do make it a link to www.domain.com/'country' Thanks in advance Hi Chaps, I have a PHP FTP App, where users can log in using a unique code and a password. Their unique code corresponds to an FTP folder, e.g. Quote \FTP_Root\Customer A & Co\ So when the user logs in, they can see their FTP directory and contents, in this case an Inbox and an Outbox. This works as the FTP folder contains both an Inbox and an Outbox. The problem I am having is when I try browsing within this directory (say the Inbox), ftp-chdir fails. I have a hyperlink that sends a 'dir' parameter to the same ftp.php page, and if set, will attempt to change to the given directory. So even though the URL Hyperlink reads: Quote ....server.co.uk/ftp.php?dir=/FTP_Root/Customer A & Co/Inbox When you click on this link, the page tries to load: Quote ....server.co.uk/ftp.php?dir=/FTP_Root/Customer A So my question is what do I need to change, the Hyperlink to read something like: Quote ....server.co.uk/ftp.php?dir=/FTP_Root/Customer%20A%20&%20Co/Inbox Do something to the ftp-chdir function, where I encode/decode/whatever to make sure it tries to change to the correct FTP directory? Or exclude all ampersand entirely? Building a website for work. I am struggling with the login for some reason. I`m using a lot of the same code as I did for my personal site and a few other websites I`ve programmed which has always worked. But for some reason, it isn`t working now. I`ve already told it to display to me the information that`s being processed and that is all correct (it even updates the database like it`s supposed to). It just won`t show the person being logged in, which defeats the purpose of logging in, yanno? Here are all the files in question. login.php <?php include "file_calls.php"; $title = "Business Name (Beta): Log In"; include "functions.php"; session_start(); echo "$title"; echo "<p>"; echo "Log into the Business Name website. Only authorized members of the Business Name Staff can log into the website."; echo "<p>"; include "login_form.php"; ?> login_form.php <?php echo "<form action='logging.php' method='post'>"; echo "E-Mail Address:"; echo "<br><input type='text' name='email' size=60 maxlength=100>"; echo "<p>"; echo "Password:"; echo "<br><input type='password' name='pass' size=60 maxlength=25>"; echo "<p>"; $buttonlabel = "Log In"; include "formbutton_format.php"; echo "</form>"; ?> logging.php <?php include "file_calls.php"; $title = "Business Name (Beta): Logging In"; include "functions.php"; session_start(); echo "$title"; echo "<p>"; echo "Logging into the Business Name website. Only authorized members of the Business Name Staff can log into the website."; echo "<p>"; $email = $_POST['email']; $pass = $_POST['pass']; $entry_date = strftime("%B\ %e\,\ %Y %I:%M:%S %p", time()); $res = mysql_query("SELECT id, memlev, pwd1, pwd2, email, name FROM user_data WHERE email='$email'"); $by = mysql_fetch_row($res); mysql_free_result($res); $log = $by[4]; $pas = $by[2]; $pas2 = $by[3]; if ($email && $pass) { if ($by[0]) { if ($by[1] == 2) { $passwd = crypt($_REQUEST['pass'],$by[5]); if ($pass == $pas2) { mysql_query("UPDATE user_data SET lastlogin='$entry_date' WHERE email='$email'"); mysql_close($con); header("Location: index.php"); } elseif ($passwd != $pas) { header("Location: nolog.php?logout=1&m=4"); } } elseif ($by[1] == 1) { header("Location: nolog.php?logout=1&m=2"); } elseif ($by[1] == 0) { header("Location: nolog.php?logout=1&m=3"); } } elseif (!$by[0]) { header("Location: nolog.php?logout=1&m=1"); } } elseif (!$email || !$pass) { echo "<b>Error:</b> Both username and password must be entered in order to log in."; echo "<p>"; include "login_form.php"; } ?>[/php index.php [php]<?php include "file_calls.php"; $title = "Business Name (Beta)"; include "functions.php"; session_start(); echo "$title"; echo "<p>"; echo "This website is currently under construction. Thank you for your patience."; echo "<p>"; if ($lev > 1) { echo "Hello, $loggeduser !"; } elseif ($lev < 2) { echo "Not logged in."; } echo "<p>"; echo "$lev"; echo "<br>$loggeduser<br>$email"; ?> auth.php <?php // Defines DEFINE('SESSION_MAGIC','sadhjasklsad2342'); // Initialization @session_start(); @ob_start(); /* Redirects to another page */ function Redirect($to) { @session_write_close(); @ob_end_clean(); @header("Location: $to"); } /* Deletes existing session */ function RemoveSession() { $_SESSION = array(); if (isset($_COOKIE[session_name()])) { @setcookie(session_name(), '', time()+(60*60*24*365), '/'); } } /* Checks if user is logged in */ function isLoggedIn() { return(isset($_SESSION['magic']) && ($_SESSION['magic']==SESSION_MAGIC)); } /* read message count */ function CountMessages($id) { if ($res=mysql_query("SELECT * FROM user_data WHERE email='$email'")) { $count=mysql_num_rows($res); mysql_free_result($res); return($count); } return 0; } /* Go login go! */ function Login($email,$pass) { global $nmsg, $rows; $ok=false; if ($res=mysql_query("SELECT id, email, name, pwd1, pwd2, memlev FROM user_data WHERE email='$email' AND pwd2='$pass'")) { if ($rows=mysql_fetch_row($res)) { $_SESSION['sess_name'] = $rows[2]; $_SESSION['pass'] = $pass; $_SESSION['gal'] = $rows[0]; $_SESSION['level2'] = $rows[5]; $_SESSION['email'] = $rows[1]; $_SESSION['magic'] = SESSION_MAGIC; $nmsg = CountMessages($rows[0]); $ok=true; } else { include('login_failed.php'); } mysql_free_result($res); } return($ok); } /* Terminates an existing session */ function Logout() { @RemoveSession(); @session_destroy(); } /* Escape array using mysql */ function Escape(&$arr) { if (Count($arr)>0) { foreach($arr as $k => $v) { if (is_array($v)) { Escape($arr[$k]); } else { if (function_exists('get_magic_quotes')) { if(!get_magic_quotes_gpc()) { $arr[$k] = stripslashes($v); } } $arr[$k] = mysql_real_escape_string($v); } } } } // ----------------------------------------------- // Main // ----------------------------------------------- Escape($_POST); Escape($_GET); Escape($_COOKIE); Escape($_REQUEST); Escape($_GLOBALS); Escape($_SERVER); ?> file_calls.php <?php include "info_con.php"; include "auth.php"; ?> functions.php <?php echo "<title>$title</title>"; $lev=isset($_SESSION['level2'])?$_SESSION['level2']:0; $logged=isset($_SESSION['gal'])?$_SESSION['gal']:0; $loggeduser=$_SESSION['sess_name']; $nmsg = 0; $rows = isset($_SESSION['rows'])?$_SESSION['rows']:array(); $email = isset($_SESSION['email'])?$_SESSION['email']:''; $pass = isset($_SESSION['pass'])?$_SESSION['pass']:''; function rand_chars($c, $l, $u = FALSE) { if (!$u) for ($s = '', $i = 0, $z = strlen($c)-1; $i < $l; $x = rand(0,$z), $s .= $c{$x}, $i++); else for ($i = 0, $z = strlen($c)-1, $s = $c{rand(0,$z)}, $i = 1; $i != $l; $x = rand(0,$z), $s .= $c{$x}, $s = ($s{$i} == $s{$i-1} ? substr($s,0,-1) : $s), $i=strlen($s)); return $s; } function ShowLoggedInBar() { global $email,$pass,$rows,$logid; $nmes=""; if($nmsg){ $nmes="($nmsg New)"; } echo "Hello, $loggeduser !"; } /* check if we are logging out */ if (isset($_REQUEST['logout'])) { Logout(); } /* check if already logged in */ if (isset($_SESSION['magic']) && ($_SESSION['magic']==SESSION_MAGIC)) { ShowLoggedInBar(); } else { /* not logged in, is it a form post? */ if (isset($_REQUEST['email']) && isset($_REQUEST['pass'])) { $email = $_REQUEST['email']; $pass = crypt($_REQUEST['pass'],$email); Login($email,$pass); } else { } } ?> Can anyone see why it works on everything but getting the person logged in? Trying to get my output to to show 2 decimal places but keep getting syntax errors please help. Here's the code i have. Code: [Select] <?php // Input Data From Form $Cost = $_POST['fielda']; //$Cost2 = number_format(,2); //Set Current Date & Shipping Date (15 days) $Date = date('l, F d, Y'); $ShipDate = date('F d, Y',strtotime('+ 15 days')); $Tax = ($Cost * .06); $Ship = 0; //$Sub = ($Cost + $Tax); //Calculate Shipping if ($Cost <= 25.99 ){ $Ship = 3.00; } if ($Cost >= 26.00 && $Cost <= 50.99 ){ $Ship = 4.00;} if ($Cost >= 51.00 && $Cost <= 75.00) { $Ship = 5.00;} if ($Cost > 75.00) { $Ship = 6.00;} //Calculate Order Total $Total = ($Cost + $Tax + $Ship); print " Date: $Date<br><br>"; print " Cost : $$Cost<br><br> Tax: $$Tax<br><br> Shipping: $$Ship<br><br> Total: $$Total<br><br>"; print "Estimated Ship Date is $ShipDate<br> " ; ?> MOD EDIT: code tags added. I'm attempting to rewrite my urls but don't seem to be getting it to work. I've tried: RewriteEngine On RewriteRule /(.*)/(.*)/$ listings.php?ident=$1&facility=$2 And I've also tried: RewriteEngine On RewriteRule ^([^/\.]+)/([^/\.]+)?$ listings.php?ident=$1&facility=$2
Any suggestions? Hey guys I am trying to read my xml file and itterate through the list. I am having trouble.
<?xml version="1.0" encoding="UTF-8"?> <stock> <itemPlace id="1"> <name>null</name> <image>null</image> <wholeSale>44</wholeSale> <retailPrice>null</retailPrice> <quantity>null</quantity> <location>null</location> <color>null</color> <size>null</size> <weight>null</weight> <description>null</description> <itemType>null</itemType> <date>null</date> </itemPlace> <itemPlace id="2"> <name>null</name> <image>null</image> <wholeSale>55</wholeSale> <retailPrice>null</retailPrice> <quantity>null</quantity> <location>null</location> <color>null</color> <size>null</size> <weight>null</weight> <description>null</description> <itemType>null</itemType> <date>null</date> </itemPlace> </stock> <?php $xml = simplexml_load_file('stock.xml'); foreach ($xml->xpath('itemPlace') as $eq) { echo "<p><a class='inline' href=\"#inline_content\"> {$eq->name}</a></p>"; echo '<br>'; echo " <div style='display:none'>"; echo " <div id='inline_content' style='padding:10px; background:#fff;'>"; echo " <p>"; echo " <strong>{$eq->wholeSale}</strong>"; echo "</div></div>";Is there a way I can look up the object through the itemPlace id="#" and call out the parameters of the item? Like the name price, etc? I know how to mySQL query but not XML, and this is a project that needs to use xml... FML..I have been looking for a few hours so any help would be appreciated! Is it just me or is anyone else having problems with the site? When I make a reply to a post and submit it, my post is added but it also appears as an edit window still below my just-posted post. Also - when I try and edit my post the edit window opens up but the text of my post flashes by and does not show. If I re-type the entire post with my edits and save it, the edits do not appear. This has been happening for 3-4 days now. Edited by ginerjm, 30 December 2014 - 01:33 PM. Hi, My mother-in-law asked me to check on her laptop (win8) and I tried but was unable to find a solution. The problem is that the hard-drive is at a constant 100% which makes the laptop really slow except in safe mode. Process list shows no process using 100% of the hdd, I already did a chkdsk and it returned no errors. I suspect it's due to the task scheduler and stopping the active tasks indeed lowers the hdd usage to 6-11% but it does not remain there probably because new tasks are started. I also removed several software which I suspected were the ones creating the tasks to no avail. It appears as if Windows itself is running tasks that slow down the laptop to a crawl, but disabling task scheduler does not seem a good idea. Any ideas? This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=342058.0 I created an array using the array_diff function and it worked fine. My resulting array has lots of keys/values (like teamid, teamname, teamcity). I want to now display the teamid and teamcity as options in an HTML SELECT menu. I thought I would do something like this below, but it's only giving me the teamid (NOTE, I left out the Select tags because I'm good with that part of it ). How do I write the code to get the teamcity to show as well? Obviously doing something very wrong Code: [Select] $remainingteams = array_diff($allteams, $chosenteams); foreach($remainingteams as $teamid => $value){ echo "<option>" . $teamid . "-" . $remainingteams['teamcity'] . "</option>"; } I'm attempting to multiply a number. It does fine unformatted, but when I add number_format and the number is above 1,000 with a comma separator, it has problems. I tried formatting with out the comma, then adding back in after the calculation, but that did not work. $value = 1000; $multiplier = 1.02; for ($i = 1; $i <= 10; $i++) { $value = number_format($value, 2, '.', ''); $value = $value * $multiplier; $value = number_format($value, 2); echo "$$value<br />"; }
Hi guys, Sorry - this might more belong in the SQL section but I think it is PHP related. I am trying to update a table with: $sql="UPDATE $tbl_name SET (gender, description) VALUES ('$gender', '$description') WHERE image = ('$photoname')"; $result=mysql_query($sql); Needless to say, its not working. Only odd thing is that the $photoname variable is sent with a hidden field on the previous form. I can echo all 3 varaibles though and get the right results. I just dont know why it isnt updating - seems pretty standard to me. Can anyone help? Thanks! $titleurl = preg_replace('/[^a-zA-Z0-9_ -%]/', '-', $d); $titleurl = preg_replace('/[ ]/', '-', $titleurl); How do you add to this to replace ---- with - --- with - -- with - and remove quotes? How do you remove a - if it's at the very end of $titleurl. For example, replace My-iPhone- with My-iPhone errors: Deprecated: Function session_register() is deprecated in /Applications/XAMPP/xamppfiles/htdocs/login.php on line 18 Warning: session_register() [function.session-register]: Cannot send session cookie - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/login.php:18) in /Applications/XAMPP/xamppfiles/htdocs/login.php on line 18 Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at /Applications/XAMPP/xamppfiles/htdocs/login.php:18) in /Applications/XAMPP/xamppfiles/htdocs/login.php on line 18 Deprecated: Function session_register() is deprecated in /Applications/XAMPP/xamppfiles/htdocs/login.php on line 22 Code: Code: [Select] <?php if ($_POST['email']) { include_once "connect_to_mysql.php"; $email = stripslashes($_POST['email']); $email = strip_tags($email); $email = mysql_real_escape_string($email); $password = preg_replace("[^A-Za-z0-9]", "", $_POST['password']); $password = md5($password); $sql = mysql_query("SELECT * FROM members WHERE email='$email' AND password='$password' AND emailactivated='1'"); $login_check = mysql_num_rows($sql); if($login_check > 0){ while($row = mysql_fetch_array($sql)){ $id = $row["id"]; session_register('id'); $_SESSION['id'] = $id; $username = $row["username"]; session_register('username'); $_SESSION['username'] = $username; mysql_query("UPDATE members SET lastlogin=now() WHERE id='$id'"); header("location: member_profile.php?id=$id"); exit(); } } else { print '<br /><br /><font color="#FF0000">No match in our records, try again </font><br /> <br /><a href="login.php">Click here</a> to go back to the login page.'; exit(); } } ?> any help really appreciated...thanks!! TWO questions: I haven't actually CONNECTED and POSTED. My form has two input fields that combine in a TOTAL field. I notice that the address bar is carrying TOTAL=input1+input2 when it TRIES to connect. Do I need to include the TOTAL field in the database if the info is NOT relavant data? the strg and chick TOTALS? Will the database accept PARTIAL data from a form that has 25 field with only 6 being populated for testing? Hi all I'm working on a form, i've gotten all the values from the form to the process.php page and it is assigning the correct variables but i can't get it to insert into the database, i know the connection info is correct as i have other page connecting and i can create a recordset on that page. i guess my sql is wrong any help much appreciated. the following is the sql from the database and attached is the process.php page. -- Table structure for table `details` -- CREATE TABLE `details` ( `id` int(6) NOT NULL auto_increment, `first_name` varchar(20) NOT NULL, `sur_name` varchar(20) NOT NULL, `sex` varchar(6) NOT NULL, `age` varchar(3) NOT NULL, `house_no` varchar(5) NOT NULL, `street` varchar(150) NOT NULL, `town` varchar(50) NOT NULL, `bro_sis_cous_friend1` varchar(50) default NULL, `bscf_name1` varchar(150) default NULL, `and` varchar(4) NOT NULL, `bro_sis_cous_friend2` varchar(50) default NULL, `bscf_name2` varchar(150) default NULL, `his_her` varchar(4) default NULL, `him_her` varchar(4) default NULL, `from_name` varchar(150) NOT NULL, `photo_link` varchar(255) default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=36 ; [attachment deleted by admin] I wrote a simple sales tax function but it keeps come back with a sales tax of 0 the price is coming from a database. Code: [Select] function TotalSalesTax($price) { $salesTax = .07; $TotalSalesTax = $price * $salesTax; number_format($TotalSalesTax, 2); return $TotalSalesTax; } Code: [Select] <tr> <td></td> <td>Sales Tax: </td> <td><?php echo TotalSalesTax($price);?> </td> </tr> product page that the price comes from Code: [Select] <?php session_start(); if(!isset($_SESSION['quantity'])) { $_SESSION['quanity']=array(); //if there are no quantities selected, the array is empty if(is_array($_POST['quantity']))//if there are items in the cart { echo $quantity; header("location: checkOut.php"); } } require_once("functions.php"); ?> <!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"> td { border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #30C; border-right-color: #30C; border-bottom-color: #30C; border-left-color: #30C; } #productCatalog { width:400px; margin-right: auto; margin-left: auto; } </style> <link href="doggyTreats.css" rel="stylesheet" type="text/css" /> </head> <body> <?php logo(); navBar(); echo "<div id=\"productCatalog\">"; echo "<form action=\"checkOut.php\" method=\"post\" name=\"catalog\">"; DatabaseConnection(); $query = "SELECT * FROM treats"; $result_set = mysql_query($query) or die(mysql_error()); $i = 0; echo "<table>"; while ($row = mysql_fetch_array($result_set)) { echo"<tr><td width=\"2s00px\"><img src=\"{$row['product_pic']}\" /></td><td width=\"200px\">{$row['product_title']}.<br /><br />{$row['product_Description']}.<br /> Price: \${$row['price']}.<br /><br />Quantity <input name=\"quantity\" type=\"text\" size=\"2\" /></td></tr>"; } echo "<tr>"; echo "<td><input name=\"submit\" type=\"submit\" value=\"Proceed to Checkout\" />"; echo "</table>"; echo "</form>"; echo "</div>"; footer(); ?> </body> </html> I don't get why this fails. date() is meant to be a string, so why does it not concatenate correctly? Code: [Select] date_default_timezone_set('UTC'); $inputTime = date('c'); $inputTime = $inputTime . ' (UTC)'; // or $inputTime = date('c') . ' (UTC)'; Thanks. Don't have a huge deal of experience with this side of things, well php as a whole really but really struggle with this side, ive coded up a cron but it only works for 1 user, unsure as to why, i want it to do the action for every player that has item 17, the codes below any help would be appreciated, Thanks guys Code: [Select] <?php include("server.php"); $sql = "SELECT * FROM player_inventory WHERE item_id = 17"; $que = mysql_query($sql) or die(mysql_error()); $res = mysql_fetch_array($que); $sql2 = "SELECT * FROM players WHERE id = $res[player_id]"; $que2 = mysql_query($sql2); while($res2=mysql_fetch_array($que2)) { $Weight = 8 / 100 * (100 + $res2['ProductionWeight']); $Quality = 75 / 100 * (100 + $res2['ProductionWeight']); $StreetCred = $Weight * $Quality / 10; $update = "UPDATE players SET StreetCred = StreetCred + $StreetCred WHERE id = $res[player_id]"; mysql_query($update) or die(mysql_error());; $update2 = "INSERT INTO drug_inventory (player_id,quality,weight) VALUES('$res[player_id]',$Quality,$Weight)"; mysql_query($update2) or die(mysql_error());; echo "Grow Completed."; } ?> |