jarrett000 Posted April 8, 2009 Share Posted April 8, 2009 Code: <?php$name=$_GET['name'];if (!isset($name))echo "<form><input type="text" name="name" /></form>";else if (isset($name))echo "Welcome $name!";?> Problem: This works fine, is extremely simple, and took me less than a minute to do. But what I want to have done if a certain value is typed into the box it will display different results.I've been over different ways to do this on my own, and with the assistance of a friend but I simply do not know the correct if statement (if one exists).I've tried: I have attempted this with a simple guess statement (it disen't work of course): if ($name="Password") {$time=time()+10 { setcookie("name", Jarrett, $time); }} Does anyone know the CORRECT statement to do this? Link to comment Share on other sites More sharing options...
Synook Posted April 8, 2009 Share Posted April 8, 2009 The single equals sign is the assignment operator, if you want to compare two values for logical equality use ==.Don't know what is with the double curly braces either... if ($name == "Password") { $time=time()+10; setcookie("name", Jarrett, $time);} Link to comment Share on other sites More sharing options...
jarrett000 Posted April 8, 2009 Author Share Posted April 8, 2009 I've learned to do double bracers alot in JS, so I guess I just type it out without thinking about it. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.