darkfreaks Posted February 5, 2010 Share Posted February 5, 2010 okay when my form is empty i get "this user exists" which should only display if there is no matched message with is correct logic however it is flawed at the same time because it shows even if the form is empty how do i fix this? <?php if ($message) { echo "<font color=red>$message</font>"; } else { echo"<span class=c1>This User Exists and or has not Been Suspended|Deleted</span>";echo $form; }?> Link to comment https://forums.phpfreaks.com/topic/191005-if-structure-off/ Share on other sites More sharing options...
Errant_Shadow Posted February 5, 2010 Share Posted February 5, 2010 The code you have here should display whatever data is stored in the message variable, if the message variable exists. Are you saying that your script is /not/ showing the message when it /does/ exist? Link to comment https://forums.phpfreaks.com/topic/191005-if-structure-off/#findComment-1007187 Share on other sites More sharing options...
darkfreaks Posted February 5, 2010 Author Share Posted February 5, 2010 no that is not the problem it actually displays the message if it does exist however when the form is empty it displays as "This user does exist" however i think i am bypassing the code that actually checks if it is empty ore not so im redoing it. im marking this as solved for now. Link to comment https://forums.phpfreaks.com/topic/191005-if-structure-off/#findComment-1007188 Share on other sites More sharing options...
darkfreaks Posted February 5, 2010 Author Share Posted February 5, 2010 Still can not figure it out perhaps someone can see my flaw <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="generator" content="HTML Tidy for Linux (vers 6 November 2007), see www.w3.org" /> <title>User Check</title> <style type="text/css"> /*<![CDATA[*/ span.c1 {color: green} /*]]>*/ </style> <?php $user = $_POST['user']; if (empty($user)) { ?> <body> <form method="post"><input type="text" name="user"> <input type="submit" name="submit" value="Assimilate!"></form> <?php }else { $form = '<form method="post"> <input type="text" name="user"> <input type="submit" name="submit" value="Assimilate!"> </form>'; $url = 'http://vampirefreaks.com/profile.php?user='; $user = $_POST['user']; $file = file("$url$user"); foreach ($file as $lines) { $line = strip_tags($lines); $line = trim("$line"); if ($line != '') { $line = preg_replace('/\s+/', ' ', $line); $line = preg_replace('/\s+$/', ' ', $line); if ($line == 'THIS USER DOES NOT EXIST' || $line == 'Error Retreiving user info') { $message = "this user is dead<br />$form"; break; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion:') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Picture Theft') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: pervert') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Nudity. You left out the word "demented looking" from your username btw.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Nudity') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Previously deleted pervert.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: inappropriate images') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Previously Deleted Pervert') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Spamming') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: prev. deleted pedo') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: This Is Not A Sex Site.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Spam') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Picture Theft') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: -AyKayTay Again -.-') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Nudity.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: I call bullshit, you stuffed socks in there.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Brookelle.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Hardcore Pedophile') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Hannie Dropkick.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Katie Babyfayce.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Sending nudes to minors.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of FMJ_4912 @ VF.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of rusty_coconut @ VF.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Image theft.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Avril Lavigne.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Julie Elizabeth.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Multiple account.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Spam account.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: fetus has a bigger penis then that.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Alex Evans.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Daniel.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Max.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Kat Dromer.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Andres Gorgeous.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Casey Gomez.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Marta Ryden.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of DiamondSky @ vf.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of AmberOnFire @ vf.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Soulja Boy.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Tanyahahaha.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: http://vampirefreaks.com/playvideo/?v=122881') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Lesley Lock.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of YoYo Suicide.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Joy Crusifiction.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Aurora.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Billy Babydoll.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Jac Vanek.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Kitty Krunk.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Spamming girls, offering premium for webcam shows. Pathetic fucker.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Becca Louise.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Linda Cooper.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Nancy Santos.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Aoi.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Betty.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Identity theft.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Randy Romance.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Alex McKee.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Brandon Killen.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Corey Pattakos.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Tyler Christian Thompson.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Multiple image theft.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Previously deleted fake.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Gerardo Andres.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Miss Ally.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Stephanie Cooper.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Sam Llansing.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Taryn.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Taylor Parks.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Troy Lee.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Matt Rouge.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Marti Rubels.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Katie Babyfayce') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Klayton[Celldweller].') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake, pick a better Canadian next time.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Anna.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Brookelle.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Dani Gore.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Ville Valo.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Lara Jade.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Kevin Muenkel.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Kyler Krunk.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Melody.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Max.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Sam Llansing.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Image theft.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Failure to provide a salute.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Sami Syke.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Danny Leon.') { $message = "$line $user $form"; } } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Alex Evans, Randy Romance, and Niko December.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of clinical_waste.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Dolly Christ.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Alex Evans, and Ross Fretten.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Christine Dolce.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: underaged user(12)') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Angella Guzman Carrero.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Erin Rae.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Failure to provide a proper salute.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Brianna Keller.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Squeek.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Emily McCulloch.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Martin.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Identity theft.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Matthew Lush.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Rizzi Stardust.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Emma Randolf.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of TwiggX.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Jaime XTC.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Rudy Muerte.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Megan Vanmale.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Funerella.') { $message = "$line $user $form"; } if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Fake of Guin Davis.') { $message = "$line $user $form"; } if ($line == 'This User Has Been Suspended') { $by = $reason = next($file); $reason = next($file); $message = "$user Has Been Suspended By VF Admin For:$by$reason$form"; } } } if ($message) { echo "<font color=red>$message</font>"; } else { echo"<span class=c1>This User Exists and or has not Been Suspended|Deleted</span>";echo $form; } ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/191005-if-structure-off/#findComment-1007195 Share on other sites More sharing options...
Errant_Shadow Posted February 5, 2010 Share Posted February 5, 2010 I'm looking at the code you've pasted but I need a little more info to narrow it down. 1) What is it supposed to be doing? 2) What it is actually doing? Link to comment https://forums.phpfreaks.com/topic/191005-if-structure-off/#findComment-1007634 Share on other sites More sharing options...
Errant_Shadow Posted February 5, 2010 Share Posted February 5, 2010 first of all, if your scripts wasn't spitting out an error message, add <? error_reporting(E_ALL); ?> to the very top of the file. Moving on, I took a look at your php and changed a few things, all of which I commented on: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="generator" content="HTML Tidy for Linux (vers 6 November 2007), see www.w3.org" /> <title>User Check</title> <style type="text/css"> /*<![CDATA[*/ span.c1 {color: green} /*]]>*/ </style> <?php // set this to false once your code it working $debug = true; // prototype the message variable so it will be accessible outside of your statements and loops $message = ""; // this is unnecessary // $user = $_POST['user']; // just test the post variable if (isset($_POST['user'])) { // if this activates, there WILL be a message, one way or another // so make this the default message unless an error is tripped later on $message = "<span class=c1>This User Exists and/or has not Been Suspended/Deleted</span>"; $url = 'http://vampirefreaks.com/profile.php?user='; $user = $_POST['user']; $file = file("$url$user"); foreach ($file as $lines) { $line = strip_tags($lines); $line = trim("$line"); if (!empty($line)) { // if the line is NOT empty $line = preg_replace('/\s+/', ' ', $line); $line = preg_replace('/\s+$/', ' ', $line); // if the debug variable is set to true, print the line variable // this is done so you can see exactly what this data looks like if ($debug) echo "<hr />Debug:<br>line = $line<hr />"; // instead of using a whole bunch of if,then statements, // you can check for a few exceptions, then analyze the rest for a default message // first, check for some preliminary states if ($line == 'This User Has Been Suspended') { // if the user has been suspended... $by = $reason = next($file); $reason = next($file); $message = "<font color=red>$user Has Been Suspended By VF Admin For:$by$reason</font>"; } else if ($line == 'THIS USER DOES NOT EXIST' || $line == 'Error Retreiving user info') { // else, if the user has NOT been suspended, but if the user does not exist... $message = "<font color=red><b>This user is dead!</b></font>"; } else { // else, if the user has NOT been suspended, and the user DOES exist... /** * rather than checking through every possible reason that can be given, * we'll break the line into two parts: * 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion' * and the reason for deletion * * to do this, we'll use a split() operation, the syntax being $array = split("delimiter", $string); * specifically, we'll be splitting the string at the colon ( */ $lineArray = split(":", $line); /** * now, this line could have been a whole bunch of different things since you're pulling data from the web page * but if it IS what we want, then the first index of the array will be: * 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion' */ if ($lineArray[0] == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion') { // if this is the line we want, we'll reassemble the line, adding the colon back in between the message and reason $message = "<font color=red>$lineArray[0]:$lineArray[1] ($user)</font>"; } } } } // if the debug variable is set to true, print the message variable // this is done so you can see 1) if there is a message, and 2) what it says if ($debug) echo "<hr />Debug:<br>message = $message<hr />"; } // you were missing this final close bracket ?> <body> <?php // I moved this stuff down here to keep all of the HTML output in one place if (!empty($message)) { // if the message is NOT empty // note: I added the text coloring to the messages above echo "$message"; } else { // else, if it is, print some general instructions echo "Enter a User Name:"; } ?> <!-- since you're printing this regardless of the message... //--> <form method="post"> <input type="text" name="user"> <input type="submit" name="submit" value="Assimilate!"> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/191005-if-structure-off/#findComment-1007661 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.