Jump to content

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/243501-php-my-first-hour/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/243501-php-my-first-hour/#findComment-1250351
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.