Follow us on Twitter!
One mans freedom fighter, another's terrorist.
Friday, April 25, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 23
Guests Online: 23
Members Online: 0

Registered Members: 82909
Newest Member: awais
Latest Articles
View Thread

HellBound Hackers | Computer General | Hacking in general

Author

PHP help!


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 24-03-11 17:00
ok I'm really new to PHP, I like just started learning it about a week ago, anyway heres my problem:

I started working on the basic form with HTML you know the <form> tag. I wanted to make a form with HTML that you enter information and the information which is entered is processed to a PHP script, I used the POST method I'm sure all you know and used the $_POST array to get the names of the forms data. I enter the right names in the HTML form and the PHP $_POST array, this is what the HTML script looks like:

Code
<html><body>
<h4>Tizag Art Supply Order Form</h4>
<form action="process.php" method="post">
<select name="item">
<option>Paint</option>
<option>Brushes</option>
<option>Erasers</option>
</select>
Quantity: <input name="quantity" type="text" />
<input type="submit" />
</form>
</body></html>





and this is the PHP script

Code
<?php
$quantity = $_POST['quantity'];
$item = $_POST['item'];

echo $quantity . '<br>' . $item ;


?>





but when I run the PHP on Apache server it comes up with this error:

Code
Notice:Undefined index: on line 2

Notice:Undefined index: on line 3






Now I don't know what's wrong but it might be the array, but of course please correct me if I'm wrong


one more thing when I'm testing out the HTML form and submit, it downloads the PHP file into notepad and opens it, not running the PHP script...

like I said I'm very new with PHP and this is just for testing. I have watch alot of tutorials on this subject but can't seem to get it to work.

thanks for your help!




Author

RE: PHP help!

ADIGA
Member



Posts: 57
Location: Jordan - Middle East
Joined: 28.12.07
Rank:
Mad User
Posted on 24-03-11 17:10
when you run php on apache, does that mean when you run a php script or when trying to start apache???

cause from your problem it sems that php is not running on your computer, if it did the php file eill not download.

just to make life easier with those things ...
uninstall apache, php, mysql .
then download xampp.

would work great for testing.
almost no config is needed


www.hackthis.co.uk/users/images/210/1:1/50/56ba5115dde42ff71f426149a02fc0b8.jpg
adiga_php@hotmail.com adiga.hacker@yahoo.com www.adiga.ws
Author

RE: PHP help!

stealth-
Member



Posts: 1003
Location: Eh?
Joined: 10.04.09
Rank:
Mad User
Posted on 24-03-11 17:31
Yes, like ADIGA said, your PHP code is perfectly fine. You must have misconfigured apache/PHP somewhere along the lines, or don't have PHP installed correctly.


The irony of man's condition is that the deepest need is to be free of the anxiety of death and annihilation; but it is life itself which awakens it, and so we must shrink from being fully alive.
http://www.stealt. . .
http://www.stealth-x.com
Author

RE: PHP help!


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 24-03-11 18:19
stealth- wrote:
You must have misconfigured apache/PHP somewhere along the lines, or don't have PHP installed correctly.

Or he's just running the PHP script without submitting through the form he created, meaning he's sending no values to it to be found...
Maybe he thinks that what he's written is a program that needs to be running and listening for the information to handle it, fuck knows.


Author

RE: PHP help!


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 24-03-11 19:27
COM- wrote:
Or he's just running the PHP script without submitting through the form he created, meaning he's sending no values to it to be found...


I guess that was the first problem, thats why it was undefined becuase I went right the PHP server and tested it and didnít submit the array data. thanks! Grin

but I still don't know why it's downloading the source of the PHP script onto notepad and not running the script into the browser 0.o





Author

RE: PHP help!

j4m32
Member

Your avatar

Posts: 81
Location:
Joined: 01.05.10
Rank:
Newbie
Posted on 24-03-11 19:39
*FACEPALM* "... running the script into the browser"

PHP - Pre-Hypertext Processor - just by breaking down the name, "pre-hypertext" IE server side, before HTML output, some form of processing is/maybe performed.

Other languages such as:
JSP (Java Server Page),
ASP[X] (Active Server Page) and
CFM (ColdFusion Markup Language)
CGI extensions for Perl/Ruby and Python also work in the same vein.

---

Unless you are running this on some hosting which is unsuitable for PHP - in which case go and register at one of the many free PHP hosting sites.

As already stated by stealth- & ADIGA if you are developing from your PC with a local server, you need to have installed on your local machine/local server:

i)Apache
ii)PHP
(Maybe an SQL server if you are thinking of going on to doing some Database driven scripts)


More importantly, you need to configure Apache to handle PHP if you have not installed it or the installer could not automatically configure Apache to handle PHP scripts.

Since I don't know what OS you're running I've kept this guidance general.

Apache

If you installed PHP after apache, you need to make sure that it correctly automatically configured apache, go to your apache folder and look at:

conf/httpd.conf
Code

...
LoadModule phpN_module "[drive:]/path/to/php/phpNapache2[_2].[dll/so]"
AddType application/x-httpd-php .php
...





PHP

PHP may need some configuration to run certain libraries you intend to use such as: database/graphics manipulation/encryption/encoding librarires.

This can all be found in the php.ini however be sure to check from PHPInfo for the path to your php.ini, usually in the same directory as your installation of PHP.

Jim
Author

RE: PHP help!


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 24-03-11 19:44
j4m32 wrote:
*FACEPALM* "... running the script into the browser"

PHP - Pre-Hypertext Processor - just by breaking down the name, "pre-hypertext"

PHP - PHP: Hypertext Preprocessor; you know, a recursive abbreviation, kinda like GNU. It's sort of popular Wink


Author

RE: PHP help!


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 24-03-11 20:44
so that's it! I had XAMPP installed and running but I wasn't running the HTML page into the server and therefore not running the PHP script into the server. HTML of course doesn't need a server but PHP does, so thats why HTML was working and PHP was not.


thank you all for replying and helping me.

Thanks a ton!Wink