PHP - Multiple Style Changes On "this.style"
onkeydown="this.style.fontStyle='normal';"How can I add color: #000; to this? Thanks, Similar Tutorials
Background:
Question:
My experience: Code Examples:
function getInfo(ProductNumber){ $.ajax({ url:'Ajax-PHP-Page.php?ProductNumber='+ProductNumber, success: function(html) { document.getElementById("my_div").value = ''; document.getElementById("my_div").value = html; } }); }
function getInfo(ProductNumber) { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("my_div").value = this.responseText; } }; xmlhttp.open("GET","Ajax-PHP-Page.php?ProductNumber="+ProductNumber,true); xmlhttp.send(); } Thank you!! Edited May 5, 2020 by StevenOliverWell I tried adding a border to my online users box... But there are some problems.. echo "<div style="width:200px;height:100px;border:2px outset blue>$users</div>"; the ; and " in the css stuff up the php - so I get errors like this Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/scswc188/public_html/index.php on line 23 Is there a way to do this? any tutorials? Thanks Hi there, I have the following code: <?php include 'config.php'; include 'opendb.php'; $query = "SELECT shop_name, street_name, town, postcode, contact_number, web_address, user_email FROM user_info"; $result = mysql_query($query); while($row = mysql_fetch_row($result)) { $shop_name = $row[0]; $street_name = $row[1]; $town = $row[2]; $postcode = $row[3]; $contact_number = $row[4]; $web_address = $row[5]; $user_email = $row[6]; echo "<h5>Name:</h5>$shop_name <br>" . "<h5>Address</h5>$street_name <br>" . "$town <br>" . "$postcode <br>" . "<h5>Contact Details</h5>Phone Number:$contact_number <br>" . "Web Address: $web_address <br>" . "Email : $user_email <br><br>"; } include 'closedb.php'; ?> But i want to make the echo return in a box which is created by the div in the css? How do i do this? Please Help!!! Hi, I use the following style for building my websites, I understand this is a fairly common style and was wondering if there is a name for it? Code: [Select] <?php include ('application.php'); include ('cms_config.php'); include ('templates/header.php'); switch ($_GET['action']) { case "home" : display_home(); break; case "services" : display_services(); break; case "testimonials" : display_testimonials(); break; case "contact" : display_contact(); break; default : display_home(); break; } include ('templates/footer.php'); // Function list // Display home page function display_home(){ $qid = mysql_query('SELECT * FROM testimonials ORDER BY RAND() LIMIT 0,1;'); include('templates/home.php'); } // Display services page function display_services(){ include('templates/services.php'); } // Display testimonials page function display_testimonials(){ $qid = mysql_query('SELECT * FROM Testimonials'); include('templates/testimonials.php'); } // Display home page function display_contact(){ include('templates/contact.php'); } ?> I have an echo here, and not sure where about's I can put <br /> and want to be able to style it in the css (need to create a div class or something on it) Thank You Code: [Select] echo 'address="' . parseToXML($row['address']) . '" '; I basically would like to style the third and fourth echo, could i give it a ID then style it in css, how would i do this? any help is appreciated. my php code: Code: [Select] { $i = 0; echo '<div style="font-family:helvetica; font-size:15px; padding-left:15px; padding-top:20px;">'; while($row = mysql_fetch_array($result)) { // Loop through results $i++; echo '<img class="image1" src="'. $row['images'] .'" />'; //image echo "Displaying record $i<br>\n"; echo "<b>" . $row['id'] . "</b><br>\n"; // Where 'id' is the column/field title in the database echo "Location: ". $row['Location'] . "<br>\n"; // Where 'location' is the column/field title in the database echo "Property Type: ". $row['Property_type'] . "<br>\n"; // as above echo "Bedrooms: ". $row['Number_of_bedrooms'] . "<br>\n"; // .. echo "Purchase Type: ". $row['Purchase_type'] . "<br>\n"; // .. echo "Price: ". $row['Price_range'] . "<br>\n"; // .. } Hi,
I am trying to align sections of my CSS layout side-by-side, but I am having problems with it.
I expect the left sidebar (#aside) with a 30% width to meet with the content section (#content) of the width of 70%. But, the changes I make are not translating as expected.
See attached screenshort of what is happening and the CSS code bellow:
#container { margin: 0 auto; width: 800px; background: #fff; } #header { background: #5a83c3; padding: 20px; } #header h1 { margin: 0; } #navigation { float: left; width: 100%; background: #d1dceb; border-top: 1px solid #fff; } #navigation ul { margin: 0; padding: 0; } #navigation ul li { list-style-type: none; display: inline; } #navigation li a { display: block; float: left; padding: 5px 10px; color: #fff; text-decoration: none; border-right: 1px solid #fff; } #navigation li a:hover { background: #383; } #content-container { float: right; width: 100%; background: #FFF url(layout-two-liquid-background.gif) repeat-y 68% 0; } #content { clear: right; float: right; width: 70%; padding: 10px 0; margin: 0 0 0 4%; display: inline; background: #dfe6ef; border-top: 1px solid #fff; border-left: 1px solid #fff; border-bottom: 1px solid #fff; } #content h2 { margin: 0; } #aside { float: left; width: 20%; padding: 10px 0; margin: 0 3% 0 0; display: inline; background: #d1dceb; border-top: 1px solid #fff; } #aside h3 { margin: 0; } #footer { clear: right; background: #d1dceb; text-align: right; padding: 20px; width: 68%; float: right; overflow: hidden; } #footer p.left { float: left; text-align: left; margin-left: 5px; } #footer p.right { float: right; text-align: right; margin-right: 5px; }Attached Files screenshort.png 90.3KB 0 downloads How can I style this drop-down list/box in IE, so it looks the same as how I have it in Chrome?
(see attached images)
Hello! Quick question which I hope someone will be able to answer! How do I apply this style Code: [Select] <style type="text/css"> .text { font-family: Arial, Helvetica, sans-serif; color: #666; font-size: 12px; font-weight: normal; text-decoration: none; margin-right: 15px; } </style> to the code below, which will become text in an PHP generated HTML email Code: [Select] $message .= "Dear ".clean_string($Name).",\n\n"; $message .= "Thank you for your message.\n\n"; I beleive I need to use a css span class but can't get it to work! Thanks! Hello guys, I am a beginner in PHP, so please be gentle. I am building this website for a friend of mine. This website is made up by HTML/CSS. i.e., I have a page made with HTML & CSS. there are a few menus on the page. say Home, About Us, Contact Us, etc., Now I want to separate the page elements (like header/footer) from the page so as its easy to work on. the source is something like this Code: [Select] <HTML> <HEAD> <TITLE> My Page </TITLE> <LINK REL="STYLESHEET" HREF="./mystyle.css" TYPE="text/css" /> </HEAD> <BODY> <DIV ID="wrapper"> <DIV ID="header"> <DIV ID="logo"> <UL ID="menu"> <LI> <A HREF="./index.php"><SPAN>Home</SPAN></A> </LI> <LI> <A HREF="./login.php"><SPAN>Login</SPAN></A> </LI> <LI> <A HREF="./contactus.php"><SPAN>Contact Us</SPAN></A> </LI> </UL> <DIV ID="date"> <?php echo Date("d M Y");?> </DIV> </DIV> </DIV> <DIV ID="bodywrapper"> <DIV ID="main"> <DIV ID="content"> THIS IS A TEST! </DIV> </DIV> </DIV> <DIV ID ="clearfooter"></DIV> </DIV> <DIV ID="footer"> © <?php echo date("Y");?> </DIV> </BODY> </HTML> now I will have my content in the DIV called 'content'. now I have separated this one page into three different pages. like this: header.php Code: [Select] <HTML> <HEAD> <TITLE> My Page </TITLE> <LINK REL="STYLESHEET" HREF="./mystyle.css" TYPE="text/css" /> </HEAD> <BODY> <DIV ID="wrapper"> <DIV ID="header"> <DIV ID="logo"> <UL ID="menu"> <LI> <A HREF="./index.php"><SPAN>Home</SPAN></A> </LI> <LI> <A HREF="./login.php"><SPAN>Login</SPAN></A> </LI> <LI> <A HREF="./contactus.php"><SPAN>Contact Us</SPAN></A> </LI> </UL> <DIV ID="date"> <?php echo Date("d M Y");?> </DIV> </DIV> </DIV> footer.php Code: [Select] <DIV ID ="clearfooter"></DIV> </DIV> <DIV ID="footer"> © <?php echo date("Y");?> </DIV> </BODY> </HTML> and index.php Code: [Select] <?php include_once('header.php');?> <DIV ID="bodywrapper"> <DIV ID="main"> <DIV ID="content"> THIS IS A TEST </DIV> </DIV> </DIV> <?php include_once('footer.php');?> Is this the right way to code? I am worried because I have to keep in mind the safety of the website as I have to include a basic login module to this. is there any other style to write this? please do let me know.. thanks Hi, I have a (rather long) form on my site that when submitted send the information to me in an email. Ideally I would like to have the form only send me the information that has been filled out at current it sends everything. but for now I just need to know how I can style the email so its not one long list. also the form only comes through if an email adress is filled in it says it sends but I never recieve it. heres an example of the code for sending the email $Date = Trim(stripslashes($_POST['Date'])); $Packing = Trim(stripslashes($_POST['Packing'])); $Dismantle = Trim(stripslashes($_POST['Dismantle'])); $DismantleYes = Trim(stripslashes($_POST['DismantleYes'])); $Plumbing = Trim(stripslashes($_POST['Plumbing'])); $PlumbingYes = Trim(stripslashes($_POST['PlumbingYes'])); $LRSofa = Trim(stripslashes($_POST['LRSofa'])); $LRArmChair = Trim(stripslashes($_POST['LRArmChair'])); $LROtherChair = Trim(stripslashes($_POST['LROtherChair'])); $LRSCabinet = Trim(stripslashes($_POST['LRSCabinet'])); $LRLCabinet = Trim(stripslashes($_POST['LRLCabinet'])); $LRBookcase = Trim(stripslashes($_POST['LRBookcase'])); $LROTable = Trim(stripslashes($_POST['LROTable'])); $LRCTable = Trim(stripslashes($_POST['LRCTable'])); $LRTVStand = Trim(stripslashes($_POST['LRTVStand'])); $Body .= "Date of move: "; $Body .= $Date; $Body .= "\n"; $Body .= "Packing: "; $Body .= $Packing; $Body .= "\n"; $Body .= "Dismantle: "; $Body .= $Dismantle; $Body .= "\n"; $Body .= $DismantleYes; $Body .= "\n"; $Body .= "Plumbing: "; $Body .= $Plumbing; $Body .= "\n"; $Body .= $PlumbingYes; $Body .= "\n"; $Body .= "\n"; $Body .= "Living Room: "; $Body .= "\n"; $Body .= "Sofas: "; $Body .= $LRSofa; $Body .= "\n"; $Body .= "Arm Chairs: "; $Body .= $LRArmChair; $Body .= "\n"; $Body .= "Other Chairs: "; $Body .= $LROtherChair; $Body .= "\n"; $Body .= "Small Cabinets: "; $Body .= $LRSCabinet; $Body .= "\n"; $Body .= "Large Cabinets: "; $Body .= $LRLCabinet; $Body .= "\n"; $Body .= "Bookcases: "; $Body .= $LRBookcase; $Body .= "\n"; $Body .= "Occassional Tables: "; $Body .= $LROTable; $Body .= "\n"; $Body .= "Coffee Tables: "; $Body .= $LRCTable; $Body .= "\n"; $Body .= "TV Stand: "; // send email $success = mail($EmailTo, $Subject, $Body, "From: ". $FName ." ". $LName ." <". $Email.">"); // redirect to success page if ($success){ header ('Location: thankyou.php'); } else{ header ('Location: error.php'); } I need to echo <link rel="stylesheet" type="text/css" href="css/style.css" /> But! i need it to check the mysql database if the row pagestyle is empty it will echo <link rel="stylesheet" type="text/css" href="css/style.css" /> If not then it will echo <link rel="stylesheet" type="text/css" href="css/style.<? echo $pagestyle; ?>.css" /> Hello) I write html "library" for my php App in function style. But I think in OOP style will be better What do think about first and second variant. Maybe I wrote something wrong in OOP style ? /** * Create a link in button style. * @param string $txt name * @param stting $url link * @param string $title title if is empty then title = $txt * @param boolean $render if this option is true then render html object else return it */ if (!function_exists('uiButton')) { function uiButton($txt,$url,$title=NULL,$render=TRUE) { if(empty($title)) $title = $txt; // If $output is true then render else return $output if($render) echo '<span class="btn"><a href="'.$url.'" title="'.$title.'">'.$txt.'</a></span>'; else return $output; } } /** * Create a href link * @param string $txt name * @param stting $url link * @param string $title title if is empty then title = $txt */ if (!function_exists('uiLink')) { function uiLink($txt,$url,$title=NULL,$render=TRUE) { if(empty($title)) $title = $txt; $output = '<a href="'.$url.'" title="'.$title.'">'.$txt.'</a>'; // If $output is true then render else return $output if($render) echo $output; else return $output; } } if (!function_exists('uiHeading')) { function uiHeading($txt,$h='1',$render=TRUE) { $output = '<h'.$h.'>'.$txt.'</'.$h.'>'; if($render) echo $output; else return $output; } } if (!function_exists('uiBr')) { function uiBr($num = 1) { echo str_repeat("<br />", $num); } } if (!function_exists('uiNbsp')) { function uiNbsp($num = 1) { echo str_repeat(" ", $num); } } if (!function_exists('uiImg')) { function uiImg($src,$align=NULL,$alt=NULL,$border=NULL,$width=NULL,$height=NULL,$render=TRUE) { $output .= '<img '; $output .= 'src="'.$src.'" '; if(!empty($align)) $output .= 'align="'.$align.'" '; if(!empty($border)) $output .= 'border="'.$botder.'" '; if(!empty($width)) $output .= 'width="'.$width.'" '; if(!empty($height)) $output .= 'height="'.$height.'" '; if(!empty($alt)) $output .= 'alt="'.$alt.'" '; else $output .= 'alt=""'; $output .= ' />'; // If $output is true then render else return $output if($render) echo $output; else return $output; } } exemple first variant uiImg('http://site.com/img/img.png','','','',640,480,$render=TRUE) { and second variant class HTML { var $name; var $url; var $action; var $method = 'post'; var $width; var $hight; var $alt; var $title; var $align; var $class; var $id; var $style; var $border; var $value; function link() { echo '<a href='.$this->url.'>'.$this->name.'</a>'; } function formOpen() { echo '<form action="'.$this->action.'" method="'.$this->method.'">'; } function img() { $output = ''; $output .= '<img '; $output .= 'src="'.$this->url.'" '; if(!empty($this->align)) $output .= 'align="'.$this->align.'" '; if(!empty($this->border)) $output .= 'border="'.$this->border.'" '; if(!empty($this->width)) $output .= 'width="'.$this->width.'" '; if(!empty($this->height)) $output .= 'height="'.$this->height.'" '; if(!empty($this->alt)) $output .= 'alt="'.$this->alt.'" '; else $output .= 'alt=""'; $output .= ' />'; echo $output; } } $img = new HTML(); $img->url = 'http://site.com/img/img.png'; $img->width = 640; $img->height = 480; $img->img(); Ok guys, I'm gonna have to throw a question out there. I am building a mmorpg. And I could use some help with some coding. I have two cron files that run every hour and every day(24 hrs ) My question is, how can I add a visual countdown based on server time to show how long the cron has left to tick? I have tried many countdowns but most of them reset once I leave the page. So basically I need a countdown timer to show the user how long till he getts more food or whatever. Any help would be greatly appreciated. Thank you in advance for taking time to read and/or help. This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=314049.0 Hi there!, I am trying to figure out how to use preg_replace or preg_match. I want to search a text block and add a color style to all the links. How is this possible? Code: [Select] Logical Example: Search - > "<a href="whatever.php?id=123&sid=2312">" and replace with <a href="whatever.php?id=123&sid=2312" style="color: rgb(255, 250, 255);"> Howdy ya'll . . .
I am a new member here. My background with html & css is all self-taught, but I have no knowledge of PHP so I am here looking for some expert help with a problem I am having with a comments script that I have on some of the pages of my new website. So, because of my ignorance when it comes to PHP, please be gentle with me. LOL
So here is my problem:
I am using the comments script from Script Mills in the sidebar of my website.
I have overcome the first big obstacle - got it installed and working.
I posted a test comment and it worked, but I do not like the way the posted comment shows on the page.
I have searched all the script folders for a style sheet and can't find one. So my question is: how does one go about styling/changing the way the output of a script like this posts to the page?
If you need to see what I am talking about, the page http://pickmysmoker....smoker_1280.php and if it will help to understand what I am trying to do, feel free to post anything to the comment and see how it posts.
In particular, I would like to move the comments further down in the sidebar and utilize more of the sidebar area so that the comments take up more of the width.
I hope my question makes sense and there is someone here that can offer me some help/advice/guidenance in getting this squared away.
Thanks in advance . . .
example : Code: [Select] <?php code; ?> how to change CSS (i guess this is the method) using php or javascript to organize text/code like <code></code> here ! i did a search and didnt found anything useful! //$x = ereg_replace('[-a-z0-9!#$%&\'*+/=?^_`{|}~]+@([.]?[a-zA-Z0-9_/-])*','<a href=\'mailto:\\0\' '.$style.'>\\0</a>',$x); I was looking to write tutorials.
I am wondering if the procedual style is legitimate?
Because I have been reading posts on the internet like:
"horrid code" and similar, also because of issues like "SQL injection".
Any suggestions on the procedual style specifically, when one is looking to write tutorials?
|