473,788 Members | 2,895 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 1799
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
17776
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 will also make this a more balanced
6
3632
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!? <%@Language=JavaScript%> <%Response.buffer=true%> <%
2
3598
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 some variables. Some pointers may be invalid and cause the dump to abort...
7
2318
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
1839
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 information (photoID, location, phDate, category, caption). I have inputted my own photos (not via...
29
2266
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
1608
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
1890
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 other words...when they login, if they are a new user, a new account screen comes up and from there a...
1
1983
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 came without any information.. Can anyone help me it is very urgent.. Also if possible please tell...
0
9656
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
9498
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
10173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
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 most users, this new feature is actually very convenient. If you want to control the update process,...
1
7517
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
6750
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
5399
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4070
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
2
3674
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.