Jump to content


Photo

newbie ?


  • Please log in to reply
6 replies to this topic

#1 tjw

tjw

    Newbie

  • Member
  • Pip
  • 4 posts

Posted 26 April 2007 - 08:58 AM

when create a form(form name = name) in html and set the action to a php page and method post
after submiting the form it pulls up the php page but i cant even to read a simple (echo $name) varible using the form name in uniform sever. the pages work fine on my host serever.

#2 Ric

Ric

    Project Manager

  • Admin
  • PipPipPipPipPip
  • 1,535 posts
  • Gender:Male
  • Location:Cambridge,UK
  • Interests:Electronics
    Internet in general
    Open source projects
  • SourceForge IDmpgcan
  • Wiki ID: Ric
  • Main OS: Windows XP

Posted 26 April 2007 - 03:58 PM

Could you post the two test files!
OR
Check out these scripts:
Save the following to your www folder on UniServer

Note: I have corrected this post, thanks kalpz for some reason I forgot to add $_POST['Name']

Save as test1.html
<html>
<head>
<title>Test1</title>
</head>
<body >
<p>This test uses a standard link to call a PHP page</a></p>
<p><a href="test3.php?Name=Fred from test page 1">test3.php?Name=Fred from test page 1</a></p>
</body>
</html>

Save as test2.html
<html>
<head>
<title>Test2</title>
</head>
<body >
This test uses a form
<form action="test3.php" method="post" >
Name: <input type="text" name="Name" value="Fred from test page 2 using post" /></br>
<input value="Click to go to Test3.php" type="submit">
</form>
</body>
</html>

Save as test3.php
<html>
<head>
<title>Test3</title>
</head>
<body >
<?
echo 'You came from page test1.html using GET  <b>'. $_GET['Name'].'</b><br>';
echo 'You came from page test2.html using POST <b>'. $_POST['Name'].'</b>';
?>
<p><a href="test1.html">Back to test page Test1.html</a></p>
<p><a href="test2.html">Back to test page Test2.html</a></p>
</body>
</html>

Start UniServer and type http://localhost/test1.html into your browser
And follow the three links.

Note: Test2 method="post" you can use method="get"

:lol:

#3 kalpz

kalpz

    Beta Team Member

  • Beta Tester
  • PipPip
  • 132 posts
  • Location:New Zealand
  • IRC Nickname: LifeSteala
  • Main OS: Windows Vista

Posted 27 April 2007 - 03:58 AM

Instead of doing

echo $name;

try

echo $_REQUEST['name'];
ATOMIC Web Hosting 2007 - 2011
Shared Hosting - Reseller Hosting - Dedicated Servers - Virtual Private Servers (Request Dedicated/VPS Servers via E-mail)
E-mail: sales@atomicwebhosting.com Website: http://www.atomicwebhosting.com/

#4 Ric

Ric

    Project Manager

  • Admin
  • PipPipPipPipPip
  • 1,535 posts
  • Gender:Male
  • Location:Cambridge,UK
  • Interests:Electronics
    Internet in general
    Open source projects
  • SourceForge IDmpgcan
  • Wiki ID: Ric
  • Main OS: Windows XP

Posted 27 April 2007 - 09:52 AM

Thanks kalpz for some reason I forgot to add $_POST and $_GET to avoid any confusion I have replaced my original post.

Note: Most books refer to $_POST, $_GET and $_COOKIE these are separate arrays as you rightly point out $_REQUEST can be used its advantage is that it incorporates all three of the above.

:lol:

#5 tjw

tjw

    Newbie

  • Member
  • Pip
  • 4 posts

Posted 27 April 2007 - 12:11 PM

Thanks guys

#6 kalpz

kalpz

    Beta Team Member

  • Beta Tester
  • PipPip
  • 132 posts
  • Location:New Zealand
  • IRC Nickname: LifeSteala
  • Main OS: Windows Vista

Posted 29 April 2007 - 03:42 PM

No problems Ric..
ATOMIC Web Hosting 2007 - 2011
Shared Hosting - Reseller Hosting - Dedicated Servers - Virtual Private Servers (Request Dedicated/VPS Servers via E-mail)
E-mail: sales@atomicwebhosting.com Website: http://www.atomicwebhosting.com/

#7 olajideolaolorun

olajideolaolorun

    Project Manager

  • Admin
  • PipPipPipPipPip
  • 2,347 posts
  • Gender:Male
  • Location:Atlanta, GA
  • SourceForge IDempirex
  • Wiki ID: olajideolaolorun
  • IRC Nickname: Olajide
  • Main OS: Windows 10

Posted 08 May 2007 - 07:55 PM

Guys, Register Globals is Off in Uniform Server, thats why. It can be dangerous to a rookie, especially if the code is not very well coded. Thats why we turned it off.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users