Jump to content

[SOLVED] Quick little simple thing ((UNSOLVED))


djfox

Recommended Posts

Please read everything before replying.

 

$res = '<tr><td valign=top width=100% bgcolor=\"312D37\" colspan=3><b>Basic Information</b>'.CR.

 

How I make it so that the page will make that td that colour? I`ve tried the following several different ways:

bgcolor=\"312D37\"

bgcolor="312D37"

bgcolor='312D37'

bgcolor=312D37

bgcolor=\"#312D37\" (edit 1:27pm)

 

Is there anything that will make it made that td that colour that I want it to be? The result I get with all of those is no colour. I know html, the html is not working here. I`m figuring it has to do with it being within php coding. This bgcolor code works on all the other pages of mine I have except this one.

HTML is HTML whether it's inside or outside. The only difference is the escaping of the quotes. :)

 

Even though you can get away with leaving out the # sign in your hex color code it's best to remain with strict HTML coding policies and include it. The browser wars are still raging.

 

Personally I like using double quotes (" " ) for surrounding the code and singles quotes within. That way I don't have to escape them:

 

$res = "<tr><td valign=top width=100% bgcolor='#312D37' colspan=3><b>Basic Information</b></td></tr>";

HTML is HTML whether it's inside or outside. The only difference is the escaping of the quotes. :)

 

Even though you can get away with leaving out the # sign in your hex color code it's best to remain with strict HTML coding policies and include it. The browser wars are still raging.

 

Personally I like using double quotes (" " ) for surrounding the code and singles quotes within. That way I don't have to escape them:

 

$res = "<tr><td valign=top width=100% bgcolor='#312D37' colspan=3><b>Basic Information</b></td></tr>";

 

The page went blank & gave an error message when I converted the quotations.

 

Here, let me post the entire file`s coding, maybe something else in it will be helpful in figuring out why the one piece of html is not working:

<?
/*****************************************************************
settings.php

Manage user settings

******************************************************************/ 

require_once "includes/defines.php";
require_once "includes/html.php";
require_once "dbcon.php";
require_once "auth.php";
require_once "hidestatus.php";

/* if not logged in, go to main page */
if (!isLoggedIn()) {
Redirect("index.php");
}

$UserID = $_SESSION['gal'];
$Op = isset($_REQUEST['op'])?$_REQUEST['op']:OP_NONE;

/* Form vars */
$u_name = isset($_REQUEST['rn'])?$_REQUEST['rn']:'';
$u_email = isset($_REQUEST['email'])?$_REQUEST['email']:'';
$u_age = isset($_REQUEST['age'])?$_REQUEST['age']:'';
$u_gender = isset($_REQUEST['gender'])?$_REQUEST['gender']:0;
$u_country = isset($_REQUEST['country'])?$_REQUEST['country']:'None';
$u_aim = isset($_REQUEST['aim'])?$_REQUEST['aim']:'';
$u_yahoo = isset($_REQUEST['yahoo'])?$_REQUEST['yahoo']:'';
$u_msn = isset($_REQUEST['msn'])?$_REQUEST['msn']:'';
$u_icq = isset($_REQUEST['icq'])?$_REQUEST['icq']:'';
$u_livejournal = isset($_REQUEST['livejournal'])?$_REQUEST['livejournal']:'';
$u_website = isset($_REQUEST['website'])?$_REQUEST['website']:'';
$u_icon = isset($_REQUEST['icon'])?$_REQUEST['icon']:'';
$u_webcam = isset($_REQUEST['webcam'])?$_REQUEST['webcam']:'';
$u_mood = isset($_REQUEST['mood'])?$_REQUEST['mood']:0;
$u_arttype = isset($_REQUEST['arttype'])?$_REQUEST['arttype']:0;
$u_bio = isset($_REQUEST['bio'])?$_REQUEST['bio']:'';

/*
   Show user settings
*/
function ShowForm($Action) {

   	global $u_name, $u_email, $u_age, $u_gender, $u_country, $u_aim, $u_yahoo, $u_msn, $u_icq, $u_livejournal, $u_website,
   	       $u_mood, $u_bio, $u_icon, $u_webcam;
   	global $Gender, $Countries, $Moods, $arttype;
   	
   	$res = '<tr><td valign=top width=100% bgcolor="312D37" colspan=3><b>Basic Information</b>'.CR.
   	        '<tr><td width=100%><table border=0 width=100%>'.CR.
   	        '<form action="settings.php" method="post">'.CR.
   	        '<input type="hidden" name="op" value="'.$Action.'">'.CR.
	    '<tr><td>Name: <br><input type="text" name="rn" size="30" value='.$u_name.'>'.CR.
	    '<td>E-mail: <br><input type="text" name="email" size="30" value='.$u_email.'>'.CR.
		'<td>Age: <br><input type="text" name="age" size="4" value='.$u_age.'>'.CR.
		'<tr><td><tr><td><tr><td>'.CR.
		'<tr><td>Gender: <br>';
echo $res;
ComboBox('gender',$Gender,$u_gender);		
echo '<td>Country: <br>'.CR;		
    ComboBox('country',$Countries, $u_country);
echo '<td>Mood: <br>'.CR;		
    ComboBox('mood',$Moods, $u_mood);  
echo '<tr><td><tr><td><tr><td>Artist Type: <br>'.CR;		
    ComboBox('arttype',$arttype, $u_arttype);  
   
    $res = '<td>AIM Screenname: <br><input type="text" name="aim" size="30" value='.$u_aim.'>'.CR.
		'<td>Yahoo Screenname: <br><input type="text" name="yahoo" size="30" value='.$u_yahoo.'>'.CR.
		'<tr><td><tr><td><tr><td>'.CR.
		'<tr><td>MSN Screenname: <br><input type="text" name="msn" size="30" value='.$u_msn.'>'.CR.
		'<td>ICQ Screenname: <br><input type="text" name="icq" size="30" value='.$u_icq.'>'.CR.
		'<td>Livejournal Screenname: <br><input type="text" name="livejournal" size="30" value='.$u_livejournal.'>'.CR.
		'<tr><td><tr><td><tr><td>'.CR.
		'<tr><td>Website URL: <br><input type="text" name="website" size="30" value='.$u_website.'>'.CR.
		'<td>Icon URL: <br><input type="text" name="icon" size="30" value='.$u_icon.'>'.CR.
		'<td>Webcam URL: <br><input type="text" name="webcam" size="30" value='.$u_webcam.'>'.CR.
		'<tr><td valign=top width=100% bgcolor="312D37" colspan=3><b>Biography</b>'.CR.
		'<tr><td colspan=3><textarea name="bio" rows="10" cols="120" style="border: 0px; background-color:#141317; color: #B6ABCE;">'.$u_bio.
		'</textarea>'.CR.
		'<tr><td colspan=3><center><input type="submit" value="Enter"> <input type="reset" value="Clear"></center></form>'.CR.
		'</table>'.CR;
echo $res;

}

/*
   Reads user info from database
*/ 
function ReadUserInfo($id) {
   	
global $u_name, $u_email, $u_age, $u_gender, $u_country, $u_aim, $u_yahoo, $u_msn, $u_icq, $u_livejournal, $u_website,
   	       $u_mood, $u_bio, $u_icon, $u_webcam, $u_arttype;

   	if ($result=mysql_query("SELECT login, views, level, rName, age, gender, aim, yahoo, msn, ".
   	                        "icq, livejournal, bio,email, country, website, mood, icon, webcam, arttype FROM userdata WHERE id=$id"))  {
   if ($row=mysql_fetch_object($result)) {
		 $u_name = $row->rName;
		 $u_email = $row->email;
		 $u_age = $row->age;
		 $u_gender = $row->gender;
		 $u_country = $row->country;
		 $u_aim = $row->aim;
		 $u_yahoo = $row->yahoo;
		 $u_msn = $row->msn;
		 $u_icq = $row->icq;
		 $u_livejournal = $row->livejournal;
		 $u_website = $row->website;
		 $u_mood = $row->mood;
		 $u_arttype = $row->arttype;
		 $u_bio = $row->bio;
		 $u_icon = $row->icon;
		 $u_webcam = $row->webcam;		   
   }
   mysql_free_result($result);
   }
}

/*
   Reads user info from database
*/ 
function SaveUserInfo($id) {
   	
global $u_name, $u_email, $u_age, $u_gender, $u_country, $u_aim, $u_yahoo, $u_msn, $u_icq, $u_livejournal, $u_website,
   	       $u_mood, $u_bio, $u_icon, $u_webcam, $u_arttype;

   	$qry = "update userdata set rName='$u_name',age='$u_age',gender='$u_gender',aim='$u_aim',yahoo='$u_yahoo',".
   	       "msn='$u_msn',icq='$u_icq',livejournal='$u_livejournal',bio='$u_bio',email='$u_email',country='$u_country',".
   	       "website='$u_website',mood='$u_mood',icon='$u_icon',webcam='$u_webcam',arttype='$u_arttype' ".
   	       " where id=$id";
   	@mysql_query($qry);
}
    
/*
   Check values
*/
function CheckValues() {

global $u_name, $u_email, $u_age, $u_gender, $u_country, $u_aim, $u_yahoo, $u_msn, $u_icq, $u_livejournal, $u_website,
   	       $u_mood, $u_bio, $u_icon, $u_webcam, $u_arttype;

   	$ok = false;
   	if (!is_numeric($u_age)) {
   	echo "<br> Age must be numeric<br>";
   	return $ok;
   	}
   	
   	/* TODO - add more checks */
   	$ok = true;
   	return $ok;
} 	       
   	       
/*****************************************************************
Main
*****************************************************************/


switch ($Op) {
 case OP_SAVE : if (CheckValues()) {
	               SaveUserInfo($_SESSION['gal']);
	               Redirect("trancer.php");
			        }; break;
     default:
         ReadUserInfo($_SESSION['gal']);
}

$Title = "Secret Trance: Settings";

require "header.php";
ShowForm(OP_SAVE);
require "footer.php";
?>

every try

 

style="background-color:#312D37"

 

Damn, that didn`t work either.

 

It`s bothering me cuz I see the section for Biography where that bgcolor is working. I even copied that line to where Basic Information is, & that still didn`t work.

 

I don`t understand why it works for Biography & not Basic Information.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.