Aquachip Posted August 1, 2011 Share Posted August 1, 2011 Hi! I decided to take up learning PHP an hour ago. WOW its a powerful language. The reason I decided to take it up is because I need to create a database for my website. I am reading allot about PHP going hand in hand with MySQL, but I don't believe its necessary to use MySQL. So, I started reading official introduction over at the PHP website. Being someone with A.D.D, I tried so hard not to deviate, but couldn't help myself and started experimenting with code. Using the tutorial guideline, I created this: index.html <?php echo "test"; echo $_SERVER['HTTP_USER_AGENT']; ?> <form action="action.php" method="post"> <p>Enter value: <input type="text" name="value" /></p> <p><input type="submit" /></p> </form> action.php <?php echo htmlspecialchars($_POST['value']); ?> Then when mass A.D.D kicked in, I tried to guess other 'instructions' and did this: action.php <?php if ($_POST == ['1']) {echo "2"}; But I got a parse error. Its pretty obvious what I want to do, so I won't state the obvious. What I do need to learn is to create a search page for a website using radio box selections with the form POST, then PHP searches a database ("somedir/file.list")in a group list, and if the selected is in that group, then the website outputs some HTML or I guess the selection choices. I can do it in python, so I am positive it can be done in PHP. pro-airportpatdown = [party1, party4, party7] anti-taxraise = [party5 [party9, party9] neutral-iraqwar [party1 [party3] Then I want something like If question1 input in "pro-airportpatdown' then echo "Results:" then output = "/var/www/website1/partylist/party1.html" "/var/www/website1/partylist/party4.html" "/var/www/website1/partylist/party7.html" Get what I mean? I don't have the time do read the entire documentation now, I will do it next week when I have time, but just to give me an example of what I should expect, how can this be done? Oh God, all these fantastic PHP ideas are coming to my head. I actually have a head ache! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/243501-php-my-first-hour/ Share on other sites More sharing options...
Aquachip Posted August 1, 2011 Author Share Posted August 1, 2011 Awesome! The answer I was looking for was: <?php if ($value = "1") {echo "2";} ?> Is PHP the most powerful and popular server-side scripting language? Quote Link to comment https://forums.phpfreaks.com/topic/243501-php-my-first-hour/#findComment-1250347 Share on other sites More sharing options...
IrOnMaSk Posted August 1, 2011 Share Posted August 1, 2011 Is PHP the most powerful and popular server-side scripting language? No. It's not. Don't waste your time learning it Quote Link to comment https://forums.phpfreaks.com/topic/243501-php-my-first-hour/#findComment-1250349 Share on other sites More sharing options...
Maq Posted August 1, 2011 Share Posted August 1, 2011 Awesome! The answer I was looking for was: <?php if ($value = "1") {echo "2";} ?> Is PHP the most powerful and popular server-side scripting language? You probably want (==): A single equals sign assigns a value, two will compare, 3 will compare values as well as types. Quote Link to comment https://forums.phpfreaks.com/topic/243501-php-my-first-hour/#findComment-1250351 Share on other sites More sharing options...
IrOnMaSk Posted August 1, 2011 Share Posted August 1, 2011 A single equals sign assigns a value, two will compare, 3 will compare values as well as types. is there a 4 qual signs? Quote Link to comment https://forums.phpfreaks.com/topic/243501-php-my-first-hour/#findComment-1250353 Share on other sites More sharing options...
Maq Posted August 1, 2011 Share Posted August 1, 2011 A single equals sign assigns a value, two will compare, 3 will compare values as well as types. is there a 4 qual signs? No. Quote Link to comment https://forums.phpfreaks.com/topic/243501-php-my-first-hour/#findComment-1250361 Share on other sites More sharing options...
Philip Posted August 2, 2011 Share Posted August 2, 2011 is there a 4 qual signs? No. Yes. but PHP won't like you! Quote Link to comment https://forums.phpfreaks.com/topic/243501-php-my-first-hour/#findComment-1250507 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.