Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Old January 27th, 2003, 11:17 PM
spenney spenney is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 16 spenney User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
Old January 27th, 2003, 11:31 PM
filefrog filefrog is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: West Peoria, IL
Posts: 62 filefrog User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via AIM to filefrog
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:
php Code:
Original - php Code
  1.  
  2. echo "Welcome to the website
  3. ' . $_GET['$name'] . "!";


it should / would have worked.

Reply With Quote
Old January 28th, 2003, 12:06 AM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,215 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 11
Send a message via AIM to notepad
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']}

Reply With Quote
Old February 4th, 2003, 06:05 PM
noob noob is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 noob User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Passing variables from one html page to another...

hey fellas

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > Passing variables from one html page to another...


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap