473,324 Members | 2,124 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,324 software developers and data experts.

i can't seem to pass values with php

I am trying to study php from a book. But the code doesn't seem to
work for me. I set up a form, as follows:

<html>
<head>
<title>form</title>
</head>
<body>
<form action="results.php" method="GET">
<p>Name: <input type="text" name="name">
<P>
<input type="submit" name="Submit">
<input type="Reset"></form>
</body>
</html>

Then I wrote some code for a processing file titled "results.php" as
instructed:

<head>
<title>form results</title>
</head>
<body>
<?php
print("<p>Name : <b>$name</b>\n");
?>
</body>
</html>

But if I type "Jones" in the name field, it doesn't pass the name
value on to the form "results" page. It puts it up in the location bar
as

/php/results.php?name=jones&Submit=

But it doesn't appear on the Web page.

What am I doing wrong?

Thanks for any help.
Jul 17 '05 #1
7 1865
On Sun, 08 Aug 2004 10:38:14 -0700, Matthew Lasar wrote:
Path:
nwrddc01.gnilink.net!cyclone1.gnilink.net!gnilink. net!news.glorb.com!postne
ws2.google.com!not-for-mail
From: ma*****@lasarletter.com (Matthew Lasar)
Newsgroups: comp.lang.php
Subject: i can't seem to pass values with php
Date: 8 Aug 2004 10:38:14 -0700
Organization: http://groups.google.com
Lines: 40
Message-ID: <5e**************************@posting.google.com >
NNTP-Posting-Host: 63.203.71.237
X-Trace: posting.google.com 1091986695 27940 127.0.0.1 (8 Aug 2004 17:38:15
GMT)
X-Complaints-To: gr**********@google.com
NNTP-Posting-Date: Sun, 8 Aug 2004 17:38:15 +0000 (UTC)
Xref: cyclone1.gnilink.net comp.lang.php:64298
X-Received-Date: Sun, 08 Aug 2004 13:38:15 EDT (nwrddc01.gnilink.net)
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
I am trying to study php from a book. But the code doesn't seem to
work for me. I set up a form, as follows:

<html>
<head>
<title>form</title>
</head>
<body>
<form action="results.php" method="GET">
<p>Name: <input type="text" name="name">
<P>
<input type="submit" name="Submit">
<input type="Reset"></form>
</body>
</html>

Then I wrote some code for a processing file titled "results.php" as
instructed:

<head>
<title>form results</title>
</head>
<body>
<?php
print("<p>Name : <b>$name</b>\n");
?>
</body>
</html>

But if I type "Jones" in the name field, it doesn't pass the name
value on to the form "results" page. It puts it up in the location bar
as

/php/results.php?name=jones&Submit=

But it doesn't appear on the Web page.

What am I doing wrong?

Thanks for any help.

You just need to grab the value in the (automatically created) variable
$_GET

Like so

$name = $_GET["name"];
echo $name; // should say "hones"
Jul 17 '05 #2


You just need to grab the value in the (automatically created) variable
$_GET

Like so

$name = $_GET["name"];
echo $name; // should say "hones"


Now that I think about it, maybe it should say "jones"

If it says "hones", please post a follow up. That would be something.
Jul 17 '05 #3
I noticed that Message-ID:
<5e**************************@posting.google.com > from Matthew Lasar
contained the following:
I am trying to study php from a book.


$_GET a newer book.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #4
Geoff Berrow wrote:
I noticed that Message-ID:
<5e**************************@posting.google.com > from Matthew Lasar
contained the following:

I am trying to study php from a book.

$_GET a newer book.

and $_POST the authors of the original book with the words:
[self, you, shit, little, fu*k, piece, garbage, go] for writing this book.
Jul 17 '05 #5
"Maxim Vexler <hq4ever (at) 012 (dot) net (dot) il>" <"Maxim Vexler <hq4ever (at) 012 (dot) net (dot) il>"> wrote or quoted:
Geoff Berrow wrote:
<5e**************************@posting.google.com > from Matthew Lasar
I am trying to study php from a book.


$_GET a newer book.


and $_POST the authors of the original book with the words:
[self, you, shit, little, fu*k, piece, garbage, go] for writing this book.


PHP *used* to work that way.

The book's code probably worked correctly when it was written.
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #6
Tim Tyler wrote:
"Maxim Vexler <hq4ever (at) 012 (dot) net (dot) il>" <"Maxim Vexler <hq4ever (at) 012 (dot) net (dot) il>"> wrote or quoted:
Geoff Berrow wrote:
<5e**************************@posting.google.co m> from Matthew Lasar
I am trying to study php from a book.

$_GET a newer book.


and $_POST the authors of the original book with the words:
[self, you, shit, little, fu*k, piece, garbage, go] for writing this book.

PHP *used* to work that way.

The book's code probably worked correctly when it was written.

really? didn't know that.
i dive php since version 4

ok then, cancel the $_POST :)

Note to self: next time SHUT-UP !
Jul 17 '05 #7
.oO(Maxim Vexler <hq4ever (at) 012 (dot) net (dot) il>)
Geoff Berrow wrote:
I am trying to study php from a book.


$_GET a newer book.

and $_POST the authors of the original book with the words:
[self, you, shit, little, fu*k, piece, garbage, go] for writing this book.


Calm down and take a $_COOKIE. Prior to 4.2.0 PHP worked as described in
the book. In 4.2.0 the default value for register_globals went to OFF.

Using Register Globals
http://www.php.net/manual/en/security.globals.php

Micha
Jul 17 '05 #8

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

Similar topics

38
by: Kevin Smith | last post by:
For what it's worth, I wrote the original PEP 318. I probably wasn't qualified, but I just wanted a nice simple way to declare class methods without having to repeat the function name. After...
11
by: grumfish | last post by:
I'm trying to add a row to a MySQL table using insert. Here is the code: connection = MySQLdb.connect(host="localhost", user="root", passwd="pw", db="japanese") cursor = connection.cursor()...
15
by: Sue Barth | last post by:
Hi all, I hope I'm in the right ng for this... I made an .asp page that allows users to toggle thru a directory of photos. The page accomplishes the following: selects a directory of photos...
1
by: smurf | last post by:
Seems a simple question, but I can't find a simple answer: I have created a two dimensional array. I wish to send the data, a row at a time to a graph plotting routine which is expected a one...
6
by: Dan V. | last post by:
I would like to create a 2D string list (2D ArrayList ???). I would like to pass in a table or query as a parameter and have both columns transform into a 2D ArrayList. When I sort the one...
8
by: =?Utf-8?B?R3JlZyBMYXJzZW4=?= | last post by:
I'm trying to figure out how to modify a panel (panel1) from a backgroundworker thread. But can't get the panel to show the new controls added by the backgroundwork task. Here is my code. In...
14
by: Abhi | last post by:
I wrote a function foo(int arr) and its prototype is declared as foo(int arr); I modify the values of the array in the function and the values are getting modified in the main array which is...
4
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet...
0
by: John O'Hagan | last post by:
Here's a strange one for you: I have a generator function which produces lists of numbers and takes options which influence the output. The generator contains a loop, and to enable the options...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.