|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Passing variables from one html page to another...
Hi,
I am trying to follow a simple example for posting variables from one web page to another....I was hoping someone might be able to explain what this error means to me! this is where i pass my variable name: <html> <head><title>Testing Vars </title></head> <body> <a href="welcome.php?$name=Kevin">Hi, I'm Kevin! </a> </body> </html> and this is where i am getting my error: <html> <head><title>Welcome Page</title></head> <body> <? echo ("Welcome to our Web Site, $_GET['name']!"); ?> </body> </html> this is what the error says: Notice: Undefined index: 'name' in E:Inetpubwwwrootallnorth_testwelcome.php on line 10 Welcome to our Web Site, ! I know this is a very simple example, but i have to figure this out in order to apply it to what i am doing....in which i am getting the same errors only there is so much code that i cannot figure it out!! i hope someone can help, thanks. sp |
|
#2
|
|||
|
|||
|
RE: Passing variables from one html page to another...
In your link's href attribute, you need to remove the $ from the front of the variable name you are passing.
i.e.: <a href="welcome.php?name=Kevin">welcome</a> In your code, (if you do a print_r($_GET), which will dump the contents of the $_GET array) you will notice that there is an index named '$name' (literal $) with the value 'Kevin'.) So if your echo line had been: it should / would have worked. |
|
#3
|
|||
|
|||
|
RE: Passing variables from one html page to another...
$_GET['name'] should work fine, but when calling an array within a string you need to surround it w/ curly braces - {$_GET['name']}
|
|
#4
|
|||
|
|||
|
RE: Passing variables from one html page to another...
hey fellas
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > Passing variables from one html page to another... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|