473,573 Members | 2,768 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can anyone tell me what wrong with this please!

Hi,
I'm new to PHP. I followed an example on the book and wanted to pass a variable
from one html page to a php page, but it always tells me the passed variable is
undefined. I've checked the syntax over and over again, but I couldn't find the
problem. I also tried to change POST to SUBMIT and noticed the value of the
variable can be passed. Why can't the target php catch it??? The code is as
following, can any one please kindly help me out?
Very much appreciated!

----------------------HOME.htm----------------------------------------------------
<html >
<head>
<script language="JavaS cript" type="text/javascript">
function book(show) {
if (!show.contains (event.toElemen t)) {
document.showLi st.where.value = show.name;
document.showLi st.submit();
}
}
</script>
</head>
<title>Home</title>
<body>
<form name="showList" method="POST" action="test.ph p">
<input type="hidden" name="where">
<input type="button" value="BOOK" name="LaBotieII " onClick="book(t his)">
</body>
</html>
-------------------------------TEST.php----------------------------------------------
<html >
<head>
</head>
<title>TEST</title>
<body>
<?php
include("connec tion.php"); //connect to a database
connect();
echo($whichVenu e); //error message "whichVenue is undefined"
$ven =whichVenue; //error message "whichVenue is undefined"
?>
</body></html>
Jul 17 '05 #1
4 1784
What's in your 'connection.php ' file? Do you mind posting that without
the database information(i.e . username, password, etc.).

Ohdarn

Jul 17 '05 #2
what your html page passes as far as i can see the code is

$_POST['where'] = '' (empty)
$_POST['LaBotieII'] = 'BOOK'

Jul 17 '05 #3
I noticed that Message-ID: <d4***********@ bunyip2.cc.uq.e du.au> from
Fang contained the following:
I'm new to PHP. I followed an example on the book

Please let us know which book is recommending solutions that rely on
Javascript to operate so that we can avoid it.

This may get you going:

----------------------HOME.htm----------------------------------------------------
<html >
<head>
<title>Home</title>
</head>

<body>
<form method="POST" action="test.ph p">
<select name='show'>
<option>Show 1</option>
<option>Show 2</option>
<option>Show 3</option>
<option>Show 4</option>
</select>
<input type="submit" value="submit" name="Book" >
</body>
</html>
-------------------------------TEST.php----------------------------------------------
<html >
<head>
<title>TEST</title>
</head>
<body>
<?php
if (isset($_POST['show'])){
echo "<p>You selected " .$_POST['show']."</p>";
}
?>
<a href="home.htm" > Book another?</a>
</body>
</html>

--
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
One quick glance of an experienced eye allowed to understand the blurred
and almost unreadable Fang's handwriting:
Hi,
I'm new to PHP. I followed an example on the book and wanted to pass a
variable from one html page to a php page, but it always tells me the
passed variable is undefined. I've checked the syntax over and over
again, but I couldn't find the problem. I also tried to change POST to
SUBMIT and noticed the value of the
variable can be passed. Why can't the target php catch it??? The code
is as following, can any one please kindly help me out?
Very much appreciated!

----------------------HOME.htm---------------------------------------------- <html >
<head>
<script language="JavaS cript" type="text/javascript">
function book(show) {
if (!show.contains (event.toElemen t)) {
document.showLi st.where.value = show.name;
document.showLi st.submit();
}
}
</script>

</head>

<title>Home</title>
The <title></title> tag should be placed inside the <head></head>
section.
<body>
<form name="showList" method="POST" action="test.ph p">
<input type="hidden" name="where">
<input type="button" value="BOOK" name="LaBotieII "
onClick="book(t his)">
Why don't you close the <form> tag?
</body>

</html>

-------------------------------TEST.php------------------------------------- <html >
<head>
</head>
<title>TEST</title>
<body>
<?php
include("connec tion.php"); //connect to a database
connect();
echo($whichVenu e); //error message "whichVenue is undefined"
$ven=whichVenue ; //error message "whichVenue is undefined"
You don't post any variable that is named whichVenue. You post a variable
named "where" (accessible through $_POST['where']) whith value
'LaBottieII" as far as I can see, and a variable named
'LaBottieII' ($_POST['LaBottieII']) whith value 'BOOK'. No more, no
less.
?>
</body></html>


Cheers
Mike
Jul 17 '05 #5

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

Similar topics

303
17520
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b. Yahoo store was originally written in Lisp. c. Emacs The issues with these will probably come up, so I might as well mention them myself (which...
6
3624
by: What-a-Tool | last post by:
I'm going out out of my mind trying to get this to work with no luck. The error message I get is at the bottom. Can someone please tell me what I'm doing wrong here. I've tried this a million different ways and can't get it to work. I can get it to work with VBScript, but I need to do this project in JavaScript. HELP- PLEASE!? ...
2
3583
by: pratchaya | last post by:
This is my sample error in my MySQL Log New value of fp=(nil) failed sanity check, terminating stack trace! Please read http://www.mysql.com/doc/en/Using_stack_trace.html and follow instructions on how to resolve the stack trace. Resolved stack trace is much more helpful in diagnosing the problem, so please do resolve it Trying to get...
7
2308
by: Skc | last post by:
Hullo Just like to check whether anyone has tried RentACoder. I intend to farm out a small job that must use C#, WinForms, ADO.Net for around US$400, but don't know whether RentACoder is reliable. Any views anyone? BTW, I am not from United States but from a small country on the other side of the globe.
8
1833
by: Brian Basquille | last post by:
Hello all, Bit of a change of pace now. As opposed to the typical questions regarding my Air Hockey game, am also working on a Photo Album which uses an Access Database to store information about photos. This information is held inside the database (photoDB.mdb) in a table called 'photos' - information being recorded in there are photo...
29
2250
by: Roy Gourgi | last post by:
Hi, I am new to C#. I have the same time scheduling program written in C++ and it is 5 times faster than my version in C#. Why is it so slow as I thought that C# was only a little slower than C++? What am I doing wrong? Here is my code: using System;
2
1595
by: venkatesh | last post by:
hai , i am using turboc++ compiler to run my c program. i written an program with structure sa foolws struct s { float x; }y; when i am accessing the variable x it shows the following error "floating point not linked"
9
1874
by: Coleen | last post by:
Hi All :-) I am desperately looking for some help/information on how to direct page flow. Forget what I have done - here's what I need to do: I have a large ASPX.Net - VB.Net web application (around 35-40 pages) that once the user logs in, I need to direct them to the correct page, depending on what they select from the directory. In...
1
1969
by: maheshgupta0248 | last post by:
Hi everyone.. Im newbie in the driver development.. till now i have developed some drivers in Linux. Now I have to change to Windows.. can anyone tell me what are the real differences between driver development in other versions of windows and Windows Vista.. What are the advantages of driver development in Windows Vista.. I have googled but...
0
7750
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...
0
7989
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. ...
1
7744
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6369
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5559
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...
0
3708
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2170
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
1271
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1008
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...

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.