473,385 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Simple form but no output

I'm new to PHP, and created a simple form, but never get any output.
The two files, form_input.html and form_output.php are:
<html>
<body>
<form action="form_output.php" method="post">
Form input: <input name="name" size="10" type="text">
<input type="submit" value="Send">
</form>
</body>
</html>
....and...
<h2>form_output.php</h2>
<?php
$input = $_POST[ 'name' ];
echo "input = $input";
echo "_POST[ 'name' ] = $_POST[ 'name' ]";
?>
....I don't even see the <h2>form_output.php</h2> displayed. But PHP is
working, and it tests fine displaying phpinfo().

Any ideas?

Jul 17 '05 #1
3 1253
After you run it and get the blank page for form_output.php, go to View
-> View Source and copy and paste the source code. If you see
something like:
<html><head></head><body></body></html>
then there is a syntax error. You may want to try changing your echo
statements in the form_output.php like this:
$input = $_POST[ 'name' ];
echo 'input = ' . $input;
echo '_POST[ "name" ] = ' . $_POST[ 'name' ];
Putting variable names inside double quoted strings is messy and often
leads to syntax or logic errors. It also slows down the parser.

Jul 17 '05 #2
Thanks, DJ. You were right:

PHP likes the
echo "input = $input";
but not the
echo "_POST[ 'name' ] = $_POST[ 'name' ]";

Perhaps array elements are not interpolated like in Perl. I'm
definitely new to PHP.

Jul 17 '05 #3
If the example code you gave is a copy n paste then I'm sure its not
working because of a typo:
echo "_POST[ 'name' ] = $_POST[ 'name' ]"; misses a $ on the first $_POST['name']
There isnt really a need to put a space in the variable name as far as
I'm aware?? and ur code shuld read better without the space.

Regards
- Rob

da******@hotmail.com wrote: Thanks, DJ. You were right:

PHP likes the
echo "input = $input";
but not the
echo "_POST[ 'name' ] = $_POST[ 'name' ]";

Perhaps array elements are not interpolated like in Perl. I'm
definitely new to PHP.


Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: kw | last post by:
Hello, I am trying to put up a page for my students for them to be able to enter their class number into a field and instantly get a personalized text message. (ie student number 5 enters "5"...
5
by: Mark 123 | last post by:
Hi I have a form with the input fields: ProductName Quantity and output fields: ProductPrice
4
by: bob lambert | last post by:
Help I am trying to deploy to another pc a vb.net std 2002 windows form application. I am confused. I created a project - windows form I built form, compiled and debugged. I created a...
2
by: iwdu15 | last post by:
hey, i was wondering if 1) anyone could tell me whats wrong with my code, i did a little fixing to the msdn version fo this, or 2) how to make a simple program that will connect and listen for...
24
by: firstcustomer | last post by:
Hi, Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that someone will be able to point me to a ready-made solution to my problem! A friend of mine (honest!) is wanting to...
8
by: flit | last post by:
Hello All, I am trying to get information from a form and send it to a python script without success.. Here is my objective: User enters data in form --form send variables to python script...
4
by: garyusenet | last post by:
Hi. I am trying to learn about array lists, and found an example on MSDN. I tried to compile it but it's not producing any output. I can't see why. Any ideas? Here is what I did. 1....
8
by: ianenis.tiryaki | last post by:
well i wrote this code but it doesn't work and shows me bunch of syntax if you can help me out finding them i would appreciate it! the program should do simple calculations and no parenthesis...
5
by: gray_slp | last post by:
I am designing a web survey using surveymonkey.com and discovered I could use javascript to modify their standard question formats much the same as can be done in myspace. I used this feature to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.