LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-21-2013, 10:13 PM   #1
Dafydd
Member
 
Registered: Oct 2008
Posts: 344

Rep: Reputation: 29
HTML form action not passing content to PHP file


The code snippets below are taken from 'w3school' PHP forums. They are not working as expected. The content is not passed.

In searching for information on $S_SESSIONS, I seem to remembers something about this issue because it was not hooked to Apache (or something like that). I can not remember what I was searching for or where I say this and can not find it again.

Am I remembering correctly and if so, what key words do I search for? Is there a tutorial I should read on how to set up my computer so I can check performance without having to upload to a server on line? I would like to use a command line from a teminial.
Code:
opera welcome.html
welcome.html
Code:
<html>
<body>

<form action="welcome_get.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>

</body>
</html>
welcome_get.php
Code:
<html>
<body>

Welcome <?php echo $_ POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>

</body>
</html>
This is the output. The content is not passed.
Quote:
Welcome
Your email address is:
 
Old 12-21-2013, 10:30 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206
You are not loading the page as an http request, so apache and php are not in the picture.

You must have the page delivered by an http server (i.e., apache), and that server must be configured to process php mime-types as php code (see httpd.conf), then you must request it as an http request (i.e., url)

So to test on the local machine (variations by distro) enable php in the server config, start or restart the http server, and hit it with the browser as something like http://localhost/welcome.php.
 
Old 12-22-2013, 12:56 AM   #3
Dafydd
Member
 
Registered: Oct 2008
Posts: 344

Original Poster
Rep: Reputation: 29
Thank you Astrogeek. This is sorta what I'm looking for. At least a place to start. Let me chew o n this , I'll be back.
 
Old 12-22-2013, 01:41 AM   #4
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
To put it simple, code/markup written in html/css/javascript(jquery) is processed by a browser so you could just load it up like you did and test things. PHP, on the other hand is a "server-side" scripting language. It gets processed by the server (eg. Apache) which sends the output to a browser. Web browsers do not "understand" PHP.
 
  


Reply



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
how to get this content form html page source code xiutuo Programming 1 02-28-2013 04:28 AM
[SOLVED] Form action file prints the code and not the data. Dafydd Programming 3 12-23-2012 05:48 PM
[SOLVED] PHP Automatic Form Action dstu Programming 3 08-08-2011 07:19 AM
passing an array from html-forms to php prabhatsoni Linux - Software 2 06-04-2005 12:11 AM
PHP and HTML Form Post Savahn Programming 12 06-30-2004 03:15 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:04 AM.

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
Open Source Consulting | Domain Registration