Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Help with simple urlencode() probelm!

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Help with simple urlencode() probelm!

Postby pbrane » Wed Nov 13, 2002 9:16 am

Hi all,
Im still working through some exercises and have a problem getting my urlencode() to work this is my main code:

<?
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$Email = $_POST['Email'];
$Comments = $_POST['Comments'];
/* this page receives and handles the data generated by chapter3.htm */
$FirstName = trim($FirstName);
$LastName = trim($LastName);
$Email = trim($Email);
$Comments = trim($Comments);
$Name = $FirstName . " " . $LastName;
//print ("Your first name is $FirstName.<br>\n");
//print ("Your last name is $LastName.<br>\n");
print ("Your Name is $Name. <br>\n");
print ("Your E-mail address is $Email.<br>\n");
print ("This is what you had to say:<br>\n $Comments<br>\n");
$Name = urlencode($Name);
print ("<p>Click <A HREF=\"welcome.php?
Name=$Name\">here </A> to see your personalised greeting!\n");
?>

This is the HREF tag which the handeform passes to:

<html>
<head>
<title>Welcome!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php

print ("<b><center>Hello, $Name. </center></b>\n");
?>
</body>
</html>

Here is the error im getting once i hit that link word:

Notice: Undefined index: Name in C:\Program Files\Apache Group\Apache2\htdocs\adam\welcome.php on line 9

Hello, .


It looks like the welcome page just doesnt know what $Name is i looked at my source and it seems to be identicle to the book, but i wondered if anyone could help... i kow its simple problem and sorry to waste your time :D

TIA Adam
pbrane
New php-forum User
New php-forum User
 
Posts: 5
Joined: Sun Nov 03, 2002 2:28 pm
Location: Nottingham UK

Re: Help with simple urlencode() probelm!

Postby Oleg Butuzov » Thu Nov 14, 2002 3:23 am

pbrane wrote:Hi all,
Im still working through some exercises and have a problem getting my urlencode() to work this is my main code:

<?
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$Email = $_POST['Email'];
$Comments = $_POST['Comments'];
/* this page receives and handles the data generated by chapter3.htm */
$FirstName = trim($FirstName);
$LastName = trim($LastName);
$Email = trim($Email);
$Comments = trim($Comments);
$Name = $FirstName . " " . $LastName;
//print ("Your first name is $FirstName.<br>\n");
//print ("Your last name is $LastName.<br>\n");
print ("Your Name is $Name. <br>\n");
print ("Your E-mail address is $Email.<br>\n");
print ("This is what you had to say:<br>\n $Comments<br>\n");
$Name = urlencode($Name);
print ("<p>Click <A HREF="welcome.php?
Name=$Name">here </A> to see your personalised greeting!\n");
?>

This is the HREF tag which the handeform passes to:

<html>
<head>
<title>Welcome!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php

print ("<b><center>Hello, $Name. </center></b>\n");
?>
</body>
</html>

Here is the error im getting once i hit that link word:

Notice: Undefined index: Name in C:\Program Files\Apache Group\Apache2\htdocs\adam\welcome.php on line 9

Hello, .


It looks like the welcome page just doesnt know what $Name is i looked at my source and it seems to be identicle to the book, but i wondered if anyone could help... i kow its simple problem and sorry to waste your time :D

TIA Adam


I test your script - all is OK. I really donot know why you have this trouble. May I see all scripts? (includeing a form, welcome.php & your parser script)... may be I will help you...
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am


Return to PHP coding => General

Who is online

Users browsing this forum: yetticaretti and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.