Ctechinfo's coding log

Discuss all aspects of programming here.

Moderator: The Mod Squad

Ctechinfo's coding log

Postby Toby B. » Thu Oct 20, 2011 6:36 am

In the ever annoying attempt to clean up old code (on my site) and make things more efficient I am starting this thread so I can ask for assistance and get input on the project as a whole, and have it confined to one spot..
Compaq-Fu Master
Other sites:
Hydrocephalus-Talk
DSL/Cable Webserver
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14160
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Postby Toby B. » Thu Oct 20, 2011 7:39 am

10 hours tweaking code to produce 3 lines on a webpage..
Compaq-Fu Master
Other sites:
Hydrocephalus-Talk
DSL/Cable Webserver
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14160
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Postby fussnfeathers » Thu Oct 20, 2011 7:49 am

Don't you hate that? Gimme a few months, I'm finishing up a website development class in college, maybe I can help a bit.
Faster than the speed of snot

and for the million hours that we were....well I'll smile and remember them all, then I'll turn and go....
fussnfeathers
Mobo-fu Master
Mobo-fu Master
 
Posts: 3130
Joined: Thu Dec 04, 2008 8:25 pm
Location: Right behind you

Postby Toby B. » Thu Oct 20, 2011 10:14 am

fussnfeathers wrote:Don't you hate that? Gimme a few months, I'm finishing up a website development class in college, maybe I can help a bit.


yes its a pissah!! lol
Compaq-Fu Master
Other sites:
Hydrocephalus-Talk
DSL/Cable Webserver
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14160
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Postby Toby B. » Fri Oct 21, 2011 4:02 pm

The code that I work on for hours seemed to work but is buggy now.

Code: Select all
<p align="left">
<b>Found in the following systems:</b><br><?php
if (isset($modelscompaq, $modelsboth)) {
echo '<font color="#ff000"><b>Compaq</b> - <i>'.($modelscompaq).'</i></font><br><b>Compaq/HP</b> - <i>'.$modelsboth.'</i>';}
if (isset($modelsboth, $modelshp)) {
echo '<b>Compaq/HP</b> - <i>'.($modelsboth).'</i><br><font color="#0000ff"><b>HP</b> - <i>'.($modelshp).'</i></font>';}
elseif (isset($modelscompaq, $modelshp)) {
echo '<font color="#ff000"><b>Compaq</b> - <i>'.($modelscompaq).'</i></font><br><font color="#0000ff"><b>HP</b> - <i>'.($modelshp).'</i></font>';}
elseif (isset($modelsboth)) {
echo '<b>Compaq/HP</b> - <i>'.($modelsboth).'</i>';}
elseif (isset($modelscompaq)) {
echo '<font color="#ff0000"><b>Compaq</b> - <i>'.($modelscompaq).'</i></font>';}
elseif (isset($modelshp)) {
echo '<font color="#0000ff"><b>HP</b> - <i>'.($modelshp).'</i></font>';}
else {
echo "Information not availible";}?></p>


Essentailly I want the code to work in such a fashion that if two variables exist it will produce the the code for both like so:

Compaq - Models found in
HP - Models found in

OR

Compaq - Models found in
Compaq/HP - Models found in

OR

Compaq/HP - Models found in
HP - Models found in


And if only one variable exists the code would produce the corresponding line. but what is happening with the current code is it is doubling up the line that is in the two line block and single line block like

Compaq - Models found in
Compaq/HP - Models found inCompaq - Models found in
Compaq-Fu Master
Other sites:
Hydrocephalus-Talk
DSL/Cable Webserver
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14160
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine


Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests

cron