473,594 Members | 2,941 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_ou tput.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 1259
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******@hotmai l.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
2217
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" and gets a message like "Congratulations on your homerun in Kickball Bobby!" Can this be done using a form and if so would that be the best way to do it? Any help would be greatly appreciated!
5
4674
by: Mark 123 | last post by:
Hi I have a form with the input fields: ProductName Quantity and output fields: ProductPrice
4
7067
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 deployment project (myproj installer) I added my windows app to the installer under myproj installer properties, I set bootstrapper
2
1864
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 connections async. if the user pushes the selected buttons. i just want a program that connects to another computer on the port and IP address selected and if the other computer is listening, then connect to it but this code doesnt work : Imports...
24
6313
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 have on his site, a Javascript Calculator for working out the cost of what they want, for example: 1 widget and 2 widglets = £5.00
8
1876
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 --> script runs and output result. the form code
4
2065
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. Started new windows application. 2. Deleted the code files (program.cs, form.cs)
8
1549
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 are allowed.so it is basically really simple but i am new at programming and not sure about my code. Thank you! here is my code: #include <iostream>
5
1706
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 insert a weight converter into my survey. Unfortunately this script works fine in firefox v.2 but does not cooperate with the surveymonkey software when used with internet explorer v.6. Can someone explain to me in simple terms why the script...
0
7946
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7877
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8253
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
5739
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5411
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3903
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1482
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1216
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.