PHP - Div Position Messed Up After Using Php Codes
Hello.
i have created a template in dreamweaver, however when i added php code to a page the position of my bottom div got messed up... it works 100% with just text. I have a container div with other divs in it. inside the container div i have a div named content, and this div is the only div which is editable. in the bottom (outside of the container div) i have a bottom div which is centered with margin:0 auto; this divs position gets totally messed up once i add php code in the content div. http://elevweb.skit.no/0111nema/action_adventure.php here is the link to the page with php with it, as u can see the div with facebook etc in it got a messed up position. Similar TutorialsWhenever a valid ID is entered, my page stops loading and when it finally does load, it gives a lot of MySQL connection errors. What is wrong with my function code? <?php include_once("includes/config.php"); if(!$_GET['id'] && $_POST['id']) { $id = mysql_real_escape_string($_POST['id']); } elseif($_GET['id'] && !$_POST['id']) { $id = mysql_real_escape_string($_GET['id']); } else { } if(!$id) { $content = "Sorry, you have not selected a skin to view."; } else { $extract_information = mysql_query("SELECT title,username,id,password,description FROM skins WHERE id = '$id' LIMIT 1"); function displayBody($id) { mysql_query("UPDATE skins SET views = views + 1 WHERE id = '$id'"); $content = (displayBody($id)) ? $extract['title']. ", by ". $extract['username'] .".<br/><br/>Description: ". $extract['description'] ." - <a href='view.php?download=". $extract['id'] ."'>Download</a><br/><br/> <img src='skins/". $extract['id'] .".png' width='500' height='300'>" : NULL; return true; } if(mysql_num_rows($extract_information) == 0) { $content = "Sorry, no skin exists with this ID."; } else { $extract = mysql_fetch_assoc($extract_information); if($_GET['download']) { $does_exist_download = mysql_query("SELECT title,username,id,password,description FROM skins WHERE id = '$id' LIMIT 1"); if(mysql_num_rows($does_exist_download) == 0) { $content = "No skin exists with this ID, so you may not download."; } else { mysql_query("UPDATE skins SET downloads = downloads + 1 WHERE id = '". mysql_real_escape_string($_GET['download']) ."'"); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header( "Content-Disposition: attachment; filename=skins/".$extract['id'].".png"); header( "Content-Description: File Transfer"); @readfile($file); } } elseif(!$extract['password']) { displayBody($id); } elseif(!$_POST['password']) { $content = "<br/><br/><div id='header'>Password</div> <center><form action='view.php' method='POST'> <input type='hidden' name='id' value='". $id ."'>Password: <input type='password' name='password' maxlength='6'> <input type='submit' value='View'></form></center>"; } else { if($_POST['password'] != $extract['password']) { $content = "You have entered in an incorrect password. <a href='view.php?id=". $id ."'>Try Again</a> or <a href='index.php'>Home</a>."; } else { displayBody($id); } } } } ?> <html> <head> <title><?php $title; ?></title> <link rel="stylesheet" type="text/css" href="theme/style.css" /> </head> <body> <div id="header"> MCSkins </div> <?php echo $content; ?> </center> </body> </html> Hello guys, hope you are doing good. I urgently need your help at a point where I am stuck. I have created this form and applied some css to it. If I am viewing that form using Google Chrome, it looks perfectly fine but when I am viewing it using IE9 or Mozilla or viewing it on my iPhone, the whole border, button etc. gets messed up. Anybody knows how I can fix this so that it looks completely fine no matter if one is viewing it using any browser? The form can be viewed over here http://sigmalogistix.com/index3.php and this is the code: Code: [Select] <html> <head> <title>Login - Sigma Logistics</title> <style type="text/css"> form { padding:5px 450px; } img { padding:20px 521px; } a:link { color:#43759b; text-decoration:underline; } a:visited { color:#43759b; text-decoration:underline; } a:hover { color:#43759b; text-decoration:underline; } a:active { color:#43759b; text-decoration:underline; } a.otherLink:link { color:#43759b; text-decoration:none; } a.otherLink:visited { color:#43759b; text-decoration:none; } a.otherLink:hover { color:#43759b; text-decoration:underline; } a.otherLink:active { color:#43759b; text-decoration:none; } label { width: 12.2em; float: left; text-align: right; margin-right: 0.5em; display: block } .submit input { margin-left: 10.5em; } input { color: #47596e; background: #fee3ad; border: 1px solid #47596e; margin-left: 3.6em } .submit input { color: #000; background: #ffa20f; border: 2px outset #d7b9c9 } fieldset { border: 2px solid #47596e; width: 21em -moz-box-shadow: 0px 5px 12px #cdd0cc; box-shadow: 0px 5px 12px #cdd0cc; } legend { color: black; background: #ffa20c; border: 2px solid #47596e; padding: 2px 6px } </style> </head> <img src="http://sigmalogistix.com/wp-content/uploads/2012/02/Untitled-22.png" /> <form action='login.php' method='POST'> <fieldset> <legend>Track & Trace</legend> <p><label for="username"><font face="Arial" size="2">Username</font></label> <br><input type="text" name="username" size="35" /></p> <p><label for="password"><font face="Arial" size="2">Password</font></label> <br><input type="password" name="password" size="35" /></p> <p class="submit"><input type="submit" value="Log in" /></p> <a href='http://www.sigmalogistix.com'>← <font size="2" face="Arial">Back to Sigma Logistics</font></a> </fieldset> </form> </html> This is how it looks when I view it using Google Chrome 19 (everything's perfect). This is how it looks when I view it using Firefox 12 (notice that the shadow behind the form is misaligned). This is how it looks when I view it using IE9 (everything's misaligned ) And this is on iPhone's Safari browser. Please help me guys, thanks. I have a huge anonymous posting board, which relies on cookies to keep track of people. Everything works fine except for logging out. When i print_r the cookie i can see the following. When i log out the cookie is reset ... i can go to pages like www.mysite.com/page.php - but as soon as i go to a site with a modrewrite it goes back to the old cookie. ive tried setting cookies with the ending "\" however this does not seem to fix the problem. I believe the problem comes from the login cookie is set in the mysite/login/ tab and it checks for the cookie in the mysite.com/index.php tab. Hey everyone this is really really simple. say my site is www.mywebsite.com in my index page I have this define('PHPSITE_DIR', 'mywebsite'); require_once(PHPSITE_DIR . '/test/hello.php'); I have a folder named test and inside the folder i have hello.php but when i go to www.mywebsite.com i get Code: [Select] Warning: require_once(mywebsite/test/hello.php) [function.require-once]: failed to open stream: No such file or directory in wtf? i'm using godaddy server if that matters Hello,
Trying to rearrange a data on the website. Looks normal when looking through preview on IE and chrome. But once moved to live website, the whole alignment changes from left to center , including the text that needs to show up. I am a newbie to coding and dont have a clue. tried puttng something together based on what i foud on the web. attaching screenshot and the code that i did. any help is highly appreciated. also attached is a screenshot of what happens when the php file is uploaded. Prior to doing that, the menu on the left is aligned properly and the assets that we have show properly.
What we are trying to do is rearrage the whole assets into different categories.
many thanks
Attached Files
portfolio.php 3.27KB
2 downloads
noalignment.png 11KB
0 downloads Hello, I have been trying to come up with bar codes in php to represent integers for example 7432973853. How do I get a bar code for a particular string of numbers? Well my forum code is almost complete and one feature it is lacking is BB Codes. How would I go about making BB Codes for the following: Code: [Select] [URL=Url]Title[/URL] [IMG]Img Url[/IMG] [b]bold[/b] [i]Italics[/i] [u]Underline[/u] [s]Strike-through[/s] These are the only ones I want atm so any help would be appreciated. hello freinds, iam new to this forum and new to php. i have just finished a course on html and css. but now i have realised that its become comulsory for me to learn php. but iam confused as to what ellements of php i should learn. since this is a programming language i find its gonna be real tuff for me, can u please advise as to which parts i should learn first to get going. i wont be developing custom websites for customers, just for my own hobbies. my main ambition is to utilise API's in my websites. Thanx Hellow every one; i need little help to change code in my script version as i have older version codes and em using new version script so i need to change codes on my version script. iam using latest script which codes are these Quote if ($CURUSER['control_panel'] == 'yes' && $privacylevel == 'strong') print('<td class="f-border comment-details" align="left" width="15%"><center><strong>'.$postername.'</strong><br /><i>'.$title.'</i><br /><img width="80" height="80" src="'.$avatar.'"><br /><br />Uploaded: ---<br />Downloaded: ---<br />Ratio: ---<br /><br /><a href="account-details.php?id='.$row["user"].'"><img src="themes/'.$THEME.'/forums/icon_profile.gif"></a> <a href="mailbox.php?compose&id='.$row["user"].'"><img src="themes/'.$THEME.'/forums/icon_pm.gif" ></a></center></td>'); and Quote else print('<td class="f-border comment-details" align="left" width="15%"><center><strong>'.$postername.'</strong><br /><i>'.$title.'</i><br /><img width="80" height="80" src="'.$avatar.'"><br /><br />Uploaded: '.$useruploaded.'<br />Downloaded: '.$userdownloaded.'<br />Ratio: '.$userratio.'<br /><br /><a href="account-details.php?id='.$row["user"].'"><img src="themes/'.$THEME.'/forums/icon_profile.gif"></a> <a href="mailbox.php?compose&id='.$row["user"].'"><img src="themes/'.$THEME.'/forums/icon_pm.gif" ></a></center></td>'); and i want to change them under Quote if ($row["class"] == 3 || $row["donated"] > 0) { if ($site_config["donatedstar"] || $site_config["vipstar"]) { $star = "<img src=images/star.gif border=0>"; } else { $star = ""; } } if ($privacylevel != "strong" || ($CURUSER["control_panel"] == "yes")) { print("<tr><td valign=top width=150 align=left class=table_col2><center><b>$postername $star</b><br><i>$title</i></center><br>Uploaded: $useruploaded<br>Downloaded: $userdownloaded<br>Ratio: $userratio<br><br><center><img width=80 height=80 src=$avatar></center><br></td>"); and Quote }else{ print("<tr><td valign=top width=150 align=left class=table_col2><center><b>$postername $star</b><br><i>$title</i></center><br>Uploaded: ---<br>Downloaded: ---<br>Ratio: ---<br><br><center><img width=80 height=80 src=$avatar></center><br></td>"); } and one more thing i have two different images for both classes as in older codes version only one image specify for both class but em using two images for "Donated" = start.gif and for "VIP" = vip.gif so i want both images for both class so pls help me how to do them. Thanks, Regards. I am not sure what is going wrong but I have not changed any of my codes and now I am getting this error message on a simple form that I am testing. Any idea what has happened. I have had several successful tries that have updated to the db. Quote Warning: mysql_query() [function.mysql-query]: Access denied for user 'ebermy5'@'localhost' (using password: NO) in /home/ebermy5/public_html/form.php on line 20 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/ebermy5/public_html/form.php on line 20 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/ebermy5/public_html/form.php on line 21 Warning: mysql_query() [function.mysql-query]: Access denied for user 'ebermy5'@'localhost' (using password: NO) in /home/ebermy5/public_html/form.php on line 29 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/ebermy5/public_html/form.php on line 29 This is the form Code: [Select] <?php @include_once ("Connections/connect_to_mysql.php") or die('could not connect to database'); $err=''; if($_POST["submit"]){ // Validate form data if($_POST["firstname"]=='') $err.='Please enter First Name<br>'; if($_POST["email"]=='') $err.='Please enter Email<br>'; if($err==''){ // Check if there are duplicate entries in the 'contacts' table $results = mysql_query("SELECT id FROM `Members` WHERE firstname='".addslashes($_POST["firstname"])."' and Email='".addslashes($_POST["email"])."'"); if($row = mysql_fetch_array($results)){ $err.='Can not add duplicate entry<br>'; } else{ // adding new record to 'contacts' table mysql_query("INSERT INTO Members (firstname,lastname,country,Email) values ('".addslashes($_POST["firstname"])."','".addslashes($_POST["lastname"])."','".addslashes($_POST["country"])."','".addslashes($_POST["email"])."')"); // redirecting to success screen exit; } } } ?>The HTML below.. Code: [Select] <html> <head> <title>Add New Contact</title> </head> <body> <h2>Register with us</h2> <?php echo $err==''?'':('<p style="color:red;">'.$err.'</p>') ?> <form method="post" action="form.php"> <table border="0"> <tr> <td valign="middle">First Name:</td> <td><input type="text" name="firstname" size="30" value="<?php echo htmlspecialchars($firstname) ?>"></td> </tr> <tr> <td valign="middle">Last Name:</td> <td><input type="text" name="lastname" size="30" value="<?php echo htmlspecialchars($lastname) ?>"></td> </tr> <tr> <td valign="middle">Country:</td> <td><input type="text" name="country" size="30" value="<?php echo htmlspecialchars($country) ?>"></td> </tr> <tr> <td valign="middle">Email:</td> <td><input type="text" name="email" size="30" value="<?php echo htmlspecialchars($email) ?>"></td> </tr> </table><br> <input type="submit" name="submit" value=" Submit! "> </form> </body> </html> Hi, below is the output from FMS streams in XML format. and there is no way i can change the format of XML file, how do it just get just codes( like 20p5tc0bqm25an2, 42fem6h84kq3nmb, etc) Thank you <?xml version="1.0" encoding="utf-8" ?> - <result> <level>status</level> <code>NetConnection.Call.Success</code> <timestamp>8/25/2010 2:51:34 AM</timestamp> <name>_defaultRoot_:_defaultVHost_:::_1</name> - <data> <_0>20p5tc0bqm25an2</_0> <_1>42fem6h84kq3nmb</_1> <_2>b2zudqmrfqa05a6</_2> <_3>bsbzrnde1z4qmdv</_3> <_4>cgpm8wlvzyrp6b7</_4> <_5>hqy95ympgq1t5ui</_5> <_6>qa8ultkr5pv2vas</_6> <_7>qr94iqvdqag26ee</_7> <_8>wjesw80adgv4usu</_8> <_9>zcdua1yok7kw5l4</_9> </data> </result> Hey eveyone, I have this great idea I would love to do but I have some questions and whenever I have questions I come here and they always get answered :-) Anyway what do you guys know about SMS short codes (you know those commercials on TV that are like text ringtone1 to 555)? I did some quick reading and it seems they are super expensive?!? Is there anyway to get them free or cheaper if you can write your own code? Has anyone had any experience with sms short codes? Also is there anyway for a site to receive a SMS and then charge that persons service provider with php? Thanks This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=317279.0 Hello everyone, Can somebody help me? I am a novice in PHP programming. I do not understand a line of code below: $action = isset($_GET['action']) ? $_GET['action'] : ''; The variables $action saves the values obtained by the GET method, but what does this piece of code ? $_GET['action'] : ''; Thanks in advance! hello, please can anyone help me out with the codes I want to pivot it Item ID Year Type Item Value 68 2012 Assets Cash 343.556 69 2012 Assets Treasury bills 343.556 70 2012 Assets Cash and Short Term funds 687.111 71 2012 Assets Collateral by Third Parties 343.556 72 2012 Assets Operating account with Central Banks 343.556 73 2012 Assets Cash reserves with Central Banks 343.556 74 2012 Assets Overnight placements 343.556 75 2012 Assets Eskrow with Central Banks 343.556 76 2012 Assets Banks within Nigeria 343.556 77 2012 Assets Banks outside Nigeria 343.556 78 2012 Assets Inter-bank placements 343.556 79 2012 Assets Provision for doubtful balances 343.556 80 2012 Assets Federal Government of Nigeria bonds 343.556 81 2012 Assets Due from banks 2748.44 82 2012 Assets Listed equity securities 343.556 83 2012 Assets Other liquid assets 343.556 84 2012 Assets Dealing securities 687.111 85 2012 Assets Overdrafts 343.556 86 2012 Assets Term loans 0 87 2012 Assets Mortgage loans 0 88 2012 Assets Commercial paper 0 89 2012 Assets Originated by the bank 343.556 90 2012 Assets Other 0 91 2012 Assets Loan loss provision 0 92 2012 Assets Loans and advances 0 93 2012 Assets Interest in suspence 0 94 2012 Assets Advances under finance lease 0 95 2012 Assets Other assets 0 96 2012 Assets Investment securities 0 97 2012 Assets Investment in subsidiary 0 98 2012 Assets Insurance assets 0 99 2012 Assets Other facilities 0 100 2012 Assets Goodwill 0 101 2012 Assets Defferes tax assets 0 102 2012 Assets Property and equipment 0 103 2012 Assets total Assets 4809.78 to Item 2012 2011 2010 2009 2008 2007 2006 ... Cash 0 0 0 0 0 0 0 Treasury bills 0 0 0 0 0 0 0 . . . I need to do pivot it and display using PHP as all possible ways to do the using Mysql was unsuccessful I have this part of the code: for($number_words_loop = 0; $number_words_loop < $number_words; $number_words_loop++) { $value1 .= 'AND a.adtitle RLIKE \'[[:<:]]' . $words[$number_words_loop] . '[[:>:]]\''; $value2 .= 'AND a.addesc RLIKE \'[[:<:]]' . $words[$number_words_loop] . '[[:>:]]\''; } And I want to combine $value1 and $value2, so the code should look something like this: for($number_words_loop = 0; $number_words_loop < $number_words; $number_words_loop++) { $value .= 'AND a.adtitle RLIKE \'[[:<:]]' . $words[$number_words_loop] . '[[:>:]]\' OR AND a.addesc RLIKE \'[[:<:]]' . $words[$number_words_loop] . '[[:>:]]\''; } In the first code, first it checks $value1 and then $value2 one by one, and that way it checks if both of them contain all the words that are put in the search field. What I need is to check if all the words that are put in the search field are contained in the one OR in the another. I want to make it search through both of them at the same time, but I don't know how to put correctly that OR I put in the second example. So any professional help will be appreciated. Here is an example of what I mean: If the Ad has this: Ad Title: nokia phone on sale Ad Description: brand new, unpacked, with 16gb memory card included. and if someone searches for nokia sale it will show the ad, because all the search words are contained in the Ad Title. Also, if the search is brand unpacked it will also show the ad, because all the search words are contained in the Ad Description. But, the problem is if someone searches for nokia brand This way, the word nokia is not contained in the Ad Description, and the word brand is not contained in the Ad Title, so the ad will not be shown. So, I only need a way to put that OR correctly to connect those two values, just like the second code, but in the right way. Thanks in advance. I would like to have a script that would check certain parameters and if none of them returns TRUE, execute a set of codes. So the idea is somehow like if...else(). Code: [Select] <?php // trying to put if() directly within if() if ( // checking of variables if (!isset($transaction)) { echo '<font color="#FF0000">Type of transaction is not set.</font>'. '<br />'; } else { if ($transaction == 'sell') { if (empty($BV)) { echo '<font color="#FF0000">Book value is not set.</font>'. '<br />'; } } } if (empty($stock)) { echo '<font color="#FF0000">Stock symbol is not set.</font>'. '<br />'; } if (empty($price)) { echo '<font color="#FF0000">Price per share is not set.</font>'. '<br />'; } if (empty($volume)) { echo '<font color="#FF0000">Volume of shares is not set.</font>'. '<br />'; } ) { echo 'Go back and fill out necessary fields.'; } // if none of the above parameters returns TRUE else { echo 'Copy and paste the following in the email that you would be submitting.' </tr> <tr> <td> switch ($transaction) { case 'buy': include('calc_buy.php'); break; case 'sell': include('calc_sell.php'); break; default: echo '<font color="#FF0000"><b>If you see this message there is something wrong with your session. Please send us a feedback with the details of your session before seeing this message.</b></font>'; } } ?> This code returns an error and as I understand the error, it is because of if (if ()). How can I make it work? Thanks in advance! I am letting users select there color code option for text-shadow for there username I am storing them into a field called "color" HEX exaMPLE: FF6633,AA3633 First is the background color, 2nd is the foreground. (then i'll explode them) Is there a PHP function that let's me validate the input so it's HEX ONLY? I will be db escaping it and intval it too. Hi everyone,I want to learn PHP hook and I try hook examples.I tired this example but I saw only white page.It has a problem but I can't understand it Codes; hook.php <?php class Hooks { public function add($hook,$class=null,$method=null,$args=null) { if (empty($method)) error("You must include a method (function) when defining add_hook."); $this->hooks[$hook][]=array((!empty($class)?array($class,$method):$method),$args); return $this; } public function clear($hook=null) { if (!empty($hook)) unset($this->hooks[$hook]); else $this->hooks=null; } public function run($hook) { if (empty($this->hooks[$hook])) return $this; foreach ($this->hooks[$hook] as $hkey=>$hvalue) { if (is_array($hvalue[0])) $hvalue[0]=array($hvalue[0][0],$hvalue[0][1]); if (!empty($hvalue[1])) if (!is_array($hvalue[1])) call_user_func($hvalue[0],$hvalue[1]); else call_user_func_array($hvalue[0],$hvalue[1]); else call_user_func($hvalue[0]); } return $this; } } ?> script.php <?php // For a function: function doTitle() { echo $current->title; } $hooks->add('head_title',null,'doTitle'); // For a class: class Output { function body_final() { echo implode("\n",$this->body); } } $hooks->add('page_body','Output','body_final'); // To pass multiple arguments into a function, you must use: function test($arg1,$arg2) { echo "Arg1: {$arg1}, Arg2: {$arg2}"; } $hooks->add('page_body',null,'test',array('test','ing')); ?> index.php <?php // You must include the hook file here, or you can make an includes file to do all of your startup (as is normally done). include 'hook.php'; include 'script.php'; ?><!DOCTYPE html> <html> <head> <?php run('head_meta'); ?> <title><?php $hooks->run('head_title'); ?></title> <?php $hooks->run('head_links'); $hooks->run('head_scripts'); ?> </head> <body> <?php $hooks->run('page_body'); ?> </body> </html> Thank you Hi, I have a question. Currently, when I retrieve the records in my zone 'North', there is no misalignment. However when I tried to copy the same coding to make up zone 'West', the alignment went off? May I know what is the reason? Any advice to align it properly. Attached is the picture of my example <div id ="location"> <input name="zone[]" type="checkbox" id="1" value="1"> <label for="1">North</label><br /> <?php $dbc = mysqli_connect('localhost', 'aliendatabase', '1234567', 'aliendatabase') or die(mysqli_error()); $query = ("SELECT * FROM tutor_preferred_district ORDER BY district_id ASC"); $sql = mysqli_query($dbc, $query) or die(mysqli_error()); echo'<table><tr>'; // Start your table outside the loop... and your first row $count = 0; // Start your counter while($data = mysqli_fetch_array($sql)) { /* Check to see whether or not this is a *new* row If it is, then end the previous and start the next and restart the counter. */ if ($count % 3 == 0) { echo "</tr><tr>"; $count = 0; } echo '<td><input name="district[]" type="checkbox" id="'.$data['district_id'].'" value="'.$data['district_id'].'">'; echo '<label for="'.$data['district_id'].'">'.$data['district_name'].'</label></td>'; $count++; //Increment the count } echo '</tr></table><br />'; //Close your last row and your table, outside the loop ?> <input name="zone[]" type="checkbox" id="2" value="2"> <label for="2">West</label><br /> <?php $dbc = mysqli_connect('localhost', 'aliendatabase', '1234567', 'aliendatabase') or die(mysqli_error()); $query = ("SELECT * FROM tutor_preferred_district ORDER BY district_id ASC"); $sql = mysqli_query($dbc, $query) or die(mysqli_error()); echo'<table><tr>'; // Start your table outside the loop... and your first row $count = 0; // Start your counter while($data = mysqli_fetch_array($sql)) { /* Check to see whether or not this is a *new* row If it is, then end the previous and start the next and restart the counter. */ if ($count % 3 == 0) { echo "</tr><tr>"; $count = 0; } echo '<td><input name="district[]" type="checkbox" id="'.$data['district_id'].'" value="'.$data['district_id'].'">'; echo '<label for="'.$data['district_id'].'">'.$data['district_name'].'</label></td>'; $count++; //Increment the count } echo '</tr></table>'; //Close your last row and your table, outside the loop ?> </div> |