Support Forums
I Need Help In PHP Commands - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: PHP The Hypertext Preprocessor (https://www.supportforums.net/forumdisplay.php?fid=21)
+---- Thread: I Need Help In PHP Commands (/showthread.php?tid=11776)



I Need Help In PHP Commands - dareknyght - 09-04-2010

This is a piece of php code! I want to change it's font (alignment, color, weight). Please copy this code, apply the color, alignment and weight commands properly and post under the thread!

PHP Code:
if(isset($_SESSION['views']))
$_SESSION['views']=$_SESSION['views']+1;
else
$_SESSION['views']=1;
echo 
"Views="$_SESSION['views']; 

Thanks In Advance Smile


RE: I Need Help In PHP Commands - ndee - 09-04-2010

Seriously? How could you not know basic CSS, and decided to learn PHP?


Do something along the lines of:

PHP Code:
echo "<span style='color #ff0000'>Views=" $_SESSION['views'] ."</span>"



RE: I Need Help In PHP Commands - |cM| - 09-04-2010

From your post, I take that you want to style the output (i.e. echoing the total views) then you might want to place the code in a div (or echo out into a div) and give an id of 'views' then use CSS to style it.

Example:
PHP Code:
<style type="text/css">
#views {
    
border1px solid black//styles here

</
style>
<
div id="views">
<?
php
if(isset($_SESSION['views']))
$_SESSION['views']=$_SESSION['views']+1;
else
$_SESSION['views']=1;
echo 
"Views="$_SESSION['views']; 
?>
</div> 

EDIT: Beaten to it :p


RE: I Need Help In PHP Commands - dareknyght - 09-06-2010

(09-04-2010, 04:12 AM)ndee Wrote: Seriously? How could you not know basic CSS, and decided to learn PHP?


Do something along the lines of:

PHP Code:
echo "<span style='color #ff0000'>Views=" $_SESSION['views'] ."</span>"

see this page! www.dareknight.110mb.com
If i don't know the basic css then i cant make it!
i was just too lazy at that time and it made me a little confusing beacuse the Views= was getting fonted but the number was'nt! you can check the crack challenge on my site!


RE: I Need Help In PHP Commands - BreShiE - 01-15-2012

I just quickly wrote this up in Dreamweaver for you:

PHP Code:
<!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" />
<
meta name="description" content="Enter your description here." />
<
meta name="keywords" content="Enter,some,tags,here" />
<
meta name="author" content="Your Name Here" />
<
title>Title Here</title>
<
style type="text/css">
body {
    
colorred;
text-aligncenter;
font-weightbold;
}
</
style>
</
head>

<
body>
<?
php
if(isset($_SESSION['views']))
$_SESSION['views']=$_SESSION['views']+1;
else
$_SESSION['views']=1;
echo 
"Views="$_SESSION['views']; 
?>
</body>
</html> 



RE: I Need Help In PHP Commands - AceInfinity - 01-15-2012

BreSHie you've been learning PHP and you don't know how to use the increment operator yet?

PHP Code:
$_SESSION['views']++; 



RE: I Need Help In PHP Commands - Gaijin - 01-15-2012

Also.... this line makes it even faster..

PHP Code:
$_SESSION['views'] = (isset($_SESSION['views'])) ? ($_SESSION['views'] + 1) : 1