LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-29-2012, 12:04 PM   #1
harshadgotad
LQ Newbie
 
Registered: Apr 2012
Posts: 7

Rep: Reputation: Disabled
Problem with PHP


i have installed rhel 6 including ALL the OPTIONAL PACKAGES.
moreover i have made a html file linked to a PHP file in ubuntu, copied it to /var/www/html of rhel 6, and now i want to run it on my RHEL 6, but after pressing submit button in the index.html page the parameter (i.e. the name of as person)passed in html file doesn't appear.

i'm getting the out put as:
"HELLO , PHP IS WORKING!!!"


HTML CODE (file name is index.html):
<html>
<head>
<title>PHP Testing!</title>
</head>
<body>
<br/>
<form action="test.php" method="post" name="form1">
Your Name : <input type="text" name="name"><br/><br/>
<input type="submit" value="SUBMIT">
</form>
</body>
</html>


PHP CODE(file name is test.php):
<html>
<head>
<title>PHP Testing!</title>
</head>
<body>
HELLO <?php echo $_POST['name']; ?> , PHP IS WORKING!!!
</body>
</html>
 
Old 04-29-2012, 03:38 PM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 6,872

Rep: Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249
Change the line below in test.php:

PHP Code:
HELLO <?php echo $_POST['name']; ?> , PHP IS WORKING!!!
To:

PHP Code:
<?php echo "Hello " $_POST["name"] ." ".  "PHP IS WORKING!!!";?>
 
Old 04-30-2012, 12:22 AM   #3
harshadgotad
LQ Newbie
 
Registered: Apr 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
i still see the code of php after pressing submit button.
After clicking on submit it shows a prompt
"Do you want to post from data to URL file:///root/test.php (POST DATA)?"
after hitting yes, it shows a prompt again which says
"What would you like to do with the file 'test.php' (type: application/octet-stream)?
Program ('%' will be replaced by the file name)"
and it asks to open, save, display, cancel
 
Old 04-30-2012, 02:49 AM   #4
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
It seems your php is not configured fine. Or else you are not asking the browser to open the page using http protocol. It is opening it as a file.
 
Old 04-30-2012, 03:53 AM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
What happens if you just produce a file "test.php" in your
document root that has the following content?
Code:
<?php phpinfo(); ?>

Cheers,
Tink
 
Old 04-30-2012, 10:28 AM   #6
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 6,872

Rep: Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249
Quote:
"Do you want to post from data to URL file:///root/test.php (POST DATA)?"
Are you opening it in your file manager? instead of a browser with "http://localhost/index.html"?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Open edit Php file problem (PhP apache installed) waerfwe Programming 3 06-30-2011 10:29 AM
Problem upgrade php to 5.2.x from 5.1.6 missin php-common fabio vinc Linux - Newbie 1 04-15-2011 05:48 AM
php comment problem // and /* on Fedora Core 5 and PHP 5.1.4 shakeel_125 Linux - Server 4 09-29-2006 05:42 AM
php comment problem // and /* on Fedora Core 5 and PHP 5.1.4 shakeel_125 Fedora 4 09-29-2006 03:14 AM
New to PHP and Postgressql. Is this a PHP problem or a sql problem. Please help sendas4 Linux - General 2 11-05-2004 02:54 PM


All times are GMT -5. The time now is 02:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration