Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Web Coding

Reply
 
LinkBack Thread Tools
Old 06-19-08   #1 (permalink)
PC Gamer
 
Apt Quadruped's Avatar
 
amd nvidia

Join Date: Nov 2007
Location: PA
Posts: 299

Rep: 20 Apt Quadruped is acknowledged by some
Unique Rep: 0
Folding Team Rank: 488
Trader Rating: 3
Default PHP if Statments

Okay, I made up this test script to test out a form's result and I'm having troubles.
Quote:
<?php
$source = $_POST['type'];
if ($source = book)
{
print "awesome";
}
elseif ($source = mbook)
{
print "cute";
}
elseif ($source = rbook)
{
print "nice";
}
elseif ($source = volume)
{
print "splendid";
}
elseif ($source = mag)
{
print "buen";
}
elseif ($source = web)
{
print "party";
}
elseif ($source = song)
{
print "joy";
}
?>
No matter what option I fill out it only gives me the first "if" statement. Running only...
Code:
echo "$source";
I'm able to see that it does change. Therefore, I know it's my if statements that are screwy. Any suggestions?
EDIT: THIS is the form that I'm recieving $_POST['type'] from.
__________________
I am 89% addicted to Counterstrike. What about you?
Upgrades of the future...
*New GPU

System: Primary Machine
CPU
Athlon 64 X2 5000+ BE
Motherboard
MSI K9N SLI Platinum AM2 NVIDIA nForce 570
Memory
Mushkin 4gb (2x2gb) DDR2-800
Graphics Card
MSI 8600GTS
Hard Drive
320GB Seagate & two 200GB WD
Sound Card
Creative SB Audigy SE
Power Supply
Ultra X2 750-Watt
Case
XION Solaris XON-403 Black with Green LED
CPU cooling
ARCTIC COOLING Freezer 64 Pro 92mm
GPU cooling
stock
OS
Vista 64 and Gentoo amd64
Monitor
Acer 19" (LCD) X193Wbd
Apt Quadruped is offline I fold for Overclock.net   Reply With Quote
Old 06-19-08   #2 (permalink)
PC Gamer
 
Apt Quadruped's Avatar
 
amd nvidia

Join Date: Nov 2007
Location: PA
Posts: 299

Rep: 20 Apt Quadruped is acknowledged by some
Unique Rep: 0
Folding Team Rank: 488
Trader Rating: 3
Default

Nevermind, I ended up fixing it by changing several things. For those that may run into a similar problem, here is the new revision...
Quote:
<?php
$source = $_POST['type'];
if ($source == "book")
{
print "awesome";
}
elseif ($source == "mbook")
{
print "cute";
}
elseif ($source == "rbook")
{
print "nice";
}
elseif ($source == "volume")
{
print "splendid";
}
elseif ($source == "mag")
{
print "buen";
}
elseif ($source == "web")
{
print "party";
}
elseif ($source == "song")
{
print "joy";
}
?>
__________________
I am 89% addicted to Counterstrike. What about you?
Upgrades of the future...
*New GPU

System: Primary Machine
CPU
Athlon 64 X2 5000+ BE
Motherboard
MSI K9N SLI Platinum AM2 NVIDIA nForce 570
Memory
Mushkin 4gb (2x2gb) DDR2-800
Graphics Card
MSI 8600GTS
Hard Drive
320GB Seagate & two 200GB WD
Sound Card
Creative SB Audigy SE
Power Supply
Ultra X2 750-Watt
Case
XION Solaris XON-403 Black with Green LED
CPU cooling
ARCTIC COOLING Freezer 64 Pro 92mm
GPU cooling
stock
OS
Vista 64 and Gentoo amd64
Monitor
Acer 19" (LCD) X193Wbd
Apt Quadruped is offline I fold for Overclock.net   Reply With Quote
Old 06-19-08   #3 (permalink)
Extreme Cooler
 
onlycodered's Avatar
 
intel nvidia

Join Date: Mar 2008
Location: Rochester, NY
Posts: 2,921

Rep: 219 onlycodered is acknowledged by manyonlycodered is acknowledged by manyonlycodered is acknowledged by many
Unique Rep: 0
Folding Team Rank: 180
Trader Rating: 5
Default

Yeah. Gotta watch out for those double equal signs.

Don't ask me why you need to do it that way. I never understood why.
__________________
Quote:
Originally Posted by OCec3 View Post
I've put my Q6600 in cling film...
95.567% of people make up the stats in their sig. If you are part of the 4.433% who uses real stats, put this in your sig.

Fold for the cause. Fold for team 37726!
CPU-Z valid GPU-Z valid
Best CFM/noise ratio fan: Noctua NF-P12
Best air cooling budget case: Antec 300

System: The Silencer
CPU
E6600 (3.42GHz / 1.42v / lapped)
Motherboard
Gigabyte P35-DS3L rev 2
Memory
2x1GB G.SKILL DDR2 1066
Graphics Card
MSI NX8600GT (680MHz / 1800MHz)
Hard Drive
WD1600AAJS / WD3200AAJS (backup)
Sound Card
Onboard
Power Supply
Antec NeoPower 650W
Case
Antec Three Hundred
CPU cooling
HDT-S1283 / Noctua NF-P12 / Bolt-thru
GPU cooling
AC Accelero S1 rev 2
OS
Windows Vista Business x64
Monitor
NEC 19" MultiSync 95
onlycodered is online now I fold for Overclock.net onlycodered's Gallery   Reply With Quote
Old 06-19-08   #4 (permalink)
Programmer
 
intel ati

Join Date: Aug 2006
Location: Moscow, ID
Posts: 159

Rep: 10 Safetydan Unknown
Unique Rep: 0
Folding Team Rank: 1197
Trader Rating: 1
Default

Because a single = is an assignment operator, not a comparison operator, parsers can't generally decide ambiguity (should this = be an assignment or a compare?) easily
__________________
"He attacked everything in life with a mix of extraordinary genius and naive incompetence, and it was often difficult to tell which was which."
Douglas Adams

System: Monster v2
CPU
Q6600 G0
Motherboard
GA-P35-DS3L
Memory
2GB Crucial Ballistix
Graphics Card
Saphire Radeon x1900XTX
Hard Drive
WD 320GB
Sound Card
x-fi extreme music (modded)
Power Supply
OCZ 700W
Case
Gigabyte 3D aurora
CPU cooling
TR Ultra-120 Extreme
GPU cooling
vf900
OS
Windows XP
Monitor
2x Acer 22" WS
Safetydan is offline I fold for Overclock.net   Reply With Quote
Old 06-20-08   #5 (permalink)
Programmer
 
Dismounted's Avatar
 
intel ati

Join Date: Oct 2007
Location: Melbourne, Australia
Posts: 334

Rep: 41 Dismounted is acknowledged by some
Unique Rep: 0
Folding Team Rank: 539
Hardware Reviews: 2
Trader Rating: 0
Default

PHP Code:
<?php
switch($_POST['type'])
{
    case 
'book':
        echo 
'awesome';
        break;
    case 
'mbook':
        echo 
'cute';
        break;
    case 
'rbook':
        echo 
'nice'
        
break;
    case 
'volume':
        echo 
'splendid';
        break;
    case 
'mag':
        echo 
'buen';
        break;
    case 
'web':
        echo 
'party';
        break;
    case 
'song':
        echo 
'joy';
        break;
    default:
        echo 
'invalid';
        break;
}
?>
__________________
System: Powered By Xeon
CPU
Intel Xeon X3320 (45nm Quad)
Motherboard
ASUS Maximus "Rampage" Formula SE
Memory
4GB (4x1GB) Crucial Ballistix Tracer DDR2-800
Graphics Card
HIS HD 4850 IceQ 4 Turbo 512MB
Hard Drive
WD Raptor 150GB, WD Caviar SE16 500GB + 250GB
Sound Card
ASUS SupremeFX II
Power Supply
Corsair HX-620
Case
Cooler Master RC-690
CPU cooling
Thermalright Ultima-90I
GPU cooling
IceQ 4 Cooler
OS
Windows Vista 64-bit
Monitor
Samsung 226BW
Dismounted is offline I fold for Overclock.net   Reply With Quote
Old 06-20-08   #6 (permalink)
First Time Build
 
intel ati

Join Date: Dec 2007
Location: Australia
Posts: 838

Rep: 60 wolf_08 is acknowledged by some
Unique Rep: 0
Trader Rating: 0
Default

You could just add <?= not <?php its much easier.

System: Xero
CPU
Q6600
Motherboard
GA-EX38-DS4
Memory
2 * 1 DDR2 800 Kingston
Graphics Card
Gecube 3870 O/C edition
Hard Drive
1 Maxtor ATA 200gigs, 1 Samsung SATA-2 500gigs
Sound Card
Integrated sound
Power Supply
OCZ 600watts
Case
Icute with side window and 25cm side fan
OS
Vista Home Premium
Monitor
View Sonic 17"
wolf_08 is offline   Reply With Quote
Old 06-20-08   #7 (permalink)
Mmmm! Toast!
 
hometoast's Avatar
 
intel nvidia

Join Date: Sep 2007
Location: Pennsylvania
Posts: 1,032

Rep: 81 hometoast is acknowledged by some
Unique Rep: 4
Folding Team Rank: 399
Trader Rating: 8
Default

Quote:
Originally Posted by onlycodered View Post
Yeah. Gotta watch out for those double equal signs.

Don't ask me why you need to do it that way. I never understood why.
Because that's the way god intended it! Visual Basic was made by the devil.
__________________
Rocket 3 down-payment fund: [|||||||||] $6k
e6750 @ 3.2 Ghz (400x8) - 7k ppd GPU+SMP

System: Muh Box
CPU
E6750 @ 3.2Ghz
Motherboard
DFI Blood Iron
Memory
4x1G GSkill HZs @960
Graphics Card
eVGA 8800GT 512 @675/950
Hard Drive
2xWD 320 AAKS Raid0 + 74G Raptor
Sound Card
on-board. (linux!=xfi)
Power Supply
CM Extreme Power 650W
Case
CM Centurion 5
CPU cooling
AC Freezer 7
OS
Vista Ultimate 64
Monitor
Samsung 204BW
hometoast is offline I fold for Overclock.net Overclocked Account   Reply With Quote
Old 06-20-08   #8 (permalink)
Extreme Cooler
 
onlycodered's Avatar
 
intel nvidia

Join Date: Mar 2008
Location: Rochester, NY
Posts: 2,921

Rep: 219 onlycodered is acknowledged by manyonlycodered is acknowledged by manyonlycodered is acknowledged by many
Unique Rep: 0
Folding Team Rank: 180
Trader Rating: 5
Default

Quote:
Originally Posted by hometoast View Post
Because that's the way god intended it! Visual Basic was made by the devil.
When did we start talking about Visual Basic?
__________________
Quote:
Originally Posted by OCec3 View Post
I've put my Q6600 in cling film...
95.567% of people make up the stats in their sig. If you are part of the 4.433% who uses real stats, put this in your sig.

Fold for the cause. Fold for team 37726!
CPU-Z valid GPU-Z valid
Best CFM/noise ratio fan: Noctua NF-P12
Best air cooling budget case: Antec 300

System: The Silencer
CPU
E6600 (3.42GHz / 1.42v / lapped)
Motherboard
Gigabyte P35-DS3L rev 2
Memory
2x1GB G.SKILL DDR2 1066
Graphics Card
MSI NX8600GT (680MHz / 1800MHz)
Hard Drive
WD1600AAJS / WD3200AAJS (backup)
Sound Card
Onboard
Power Supply
Antec NeoPower 650W
Case
Antec Three Hundred
CPU cooling
HDT-S1283 / Noctua NF-P12 / Bolt-thru
GPU cooling
AC Accelero S1 rev 2
OS
Windows Vista Business x64
Monitor
NEC 19" MultiSync 95
onlycodered is online now I fold for Overclock.net onlycodered's Gallery   Reply With Quote
Old 06-20-08   #9 (permalink)
Linux Lobbyist
 
lattyware's Avatar
 
intel nvidia

Join Date: Feb 2007
Location: England
Posts: 1,925

Rep: 206 lattyware is acknowledged by manylattyware is acknowledged by manylattyware is acknowledged by many
Unique Rep: 0
Hardware Reviews: 1
Trader Rating: 0
Default

Quote:
Originally Posted by wolf_08 View Post
You could just add <?= not <?php its much easier.
I, personally, prefer to use the full notation. It just seems more specific. If you prefer typing less, you can always make an editor auto-complete it. Maybe it is just me.
__________________
Lattyware | Main (Sig) Rig: gBOX42 | Lan Rig: gLAN42
Never been convinced by Linux? Here is a challenge. | Using LVM
Scratched Disc? | Guide To LAN Parties | Writing a GUI application in Python/Glade
Etching an image into your case. | Wireless Access Points: Easy wireless networking.
A Member Of The OCN Anime/Manga Club
There are three types of software. Free as in speech (FOSS), Free as in beer (Freeware) and Free as in BitTorrent.

System: gBOX42
CPU
Core 2 Duo E6600 @ 3.51GHz
Motherboard
Asus P5B Deluxe/WiFi-AP
Memory
2 x OCZ DDR2 Platinum 1Gb PC6400 C4
Graphics Card
256MB MSI 8600GTS
Hard Drive
2 x 500GB SATA (ST3500641AS), 250GB IDE, 200GB IDE
Sound Card
Creative Soundblaster Audigy SE
Power Supply
SEASONIC S12-600
Case
CoolerMaster Cosmos
CPU cooling
XSPC X2O Delta CPU Waterblock V2
GPU cooling
D-Tek FuZion GFX Block
OS
Arch x64 w/KDE4.1
Monitor
Dell 2407WFP, Dell E248WFP
lattyware is offline lattyware's Gallery   Reply With Quote
Old 06-20-08   #10 (permalink)
Extreme Cooler
 
onlycodered's Avatar
 
intel nvidia

Join Date: Mar 2008
Location: Rochester, NY
Posts: 2,921

Rep: 219 onlycodered is acknowledged by manyonlycodered is acknowledged by manyonlycodered is acknowledged by many
Unique Rep: 0
Folding Team Rank: 180
Trader Rating: 5
Default

Quote:
Originally Posted by lattyware View Post
I, personally, prefer to use the full notation. It just seems more specific. If you prefer typing less, you can always make an editor auto-complete it. Maybe it is just me.
Yeah, I've always tried to avoid shorthand as well. Sometimes it can screw things up.
__________________
Quote:
Originally Posted by OCec3 View Post
I've put my Q6600 in cling film...
95.567% of people make up the stats in their sig. If you are part of the 4.433% who uses real stats, put this in your sig.

Fold for the cause. Fold for team 37726!
CPU-Z valid GPU-Z valid
Best CFM/noise ratio fan: Noctua NF-P12
Best air cooling budget case: Antec 300

System: The Silencer
CPU
E6600 (3.42GHz / 1.42v / lapped)
Motherboard
Gigabyte P35-DS3L rev 2
Memory
2x1GB G.SKILL DDR2 1066
Graphics Card
MSI NX8600GT (680MHz / 1800MHz)
Hard Drive
WD1600AAJS / WD3200AAJS (backup)
Sound Card
Onboard
Power Supply
Antec NeoPower 650W
Case
Antec Three Hundred
CPU cooling
HDT-S1283 / Noctua NF-P12 / Bolt-thru
GPU cooling
AC Accelero S1 rev 2
OS
Windows Vista Business x64
Monitor
NEC 19" MultiSync 95
onlycodered is online now I fold for Overclock.net onlycodered's Gallery   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -4. The time now is 09:34 PM.


Overclock.net is a Carbon Neutral Site Creative Commons License Internet Security By ControlScan

Terms of Service / Forum Rules | Privacy Policy | Advertising | Become an Official Vendor
Copyright © 2008 Shogun Interactive Development. Most rights reserved.
Page generated in 0.23245 seconds with 9 queries