DeveloperSide.NET Forums
December 09, 2019, 01:41:06 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Can't Use $_POST variable - Why?  (Read 18302 times)
0 Members and 3 Guests are viewing this topic.
puppynewbie
Member
*
Posts: 4


View Profile
« on: December 26, 2007, 04:17:20 PM »

Hi all:
I 've a  problem. I can't access the $_POST variable in a call to a php script? I am using Web Controller beta 0.999. I have the following code in a html file:

<FORM METHOD=POST ACTION="passing.php">
MyName:
<INPUT NAME="myname" TYPE="Text">
<INPUT TYPE=SUBMIT VALUE="Click here to Submit application">
</FORM>

In passing.php, it is like this.

<?php
$hisname=$_POST['myname'];
echo $hisname;
?>

Nothing came up.
Anybody got an answer. I can access the $_POST variable.

regards
Joe
Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #1 on: December 26, 2007, 06:24:33 PM »

try... method="post"
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
puppynewbie
Member
*
Posts: 4


View Profile
« Reply #2 on: December 30, 2007, 07:27:50 PM »

thanks but I tried this and the answer I got is:
Notice: Undefined variable: myname in C:\www\vhosts\localhost\passing.php on line 10

Here the code in passing.html:

<html>
<head>
  <title></title>
</head>
<body>
<form method="post" action="passing.php">
MyName:
<input name="myname" type="Text">
<input type="submit">
</form>
</body>
</html>

Here is the code for passing.php

<html>
<head>
  <title></title>
</head>
<body>

<?php
echo $myname;

?>
</body>
</html>
Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #3 on: December 31, 2007, 03:49:37 PM »

echo $_POST['myname'];
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
puppynewbie
Member
*
Posts: 4


View Profile
« Reply #4 on: January 01, 2008, 02:47:20 AM »

Still Can't. The version of Web Controller is v2.00. The message I got is

Notice: Undefined index: myname in C:\www\webroot\passing.php on line 10 Array PHP Notice: Undefined index: myname in C:\www\webroot\passing.php on line 10.

Is it a configuration error? But I did not change the php config file or anything like that.

Is there other ways to pass variables from a html to a php scripts?
Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #5 on: January 01, 2008, 08:20:26 PM »

Code:
<html>
<head>
<title></title>
</head>
<body>
<form method="post" action="passing.php">
MyName:
<input name="myname" type="Text">
<input type="submit">
</form>
</body>
</html>

Code:
<html>
<head>
<title></title>
</head>
<body>
<?php
echo $_POST['myname'];
?>

</body>
</html>

Works fine for me.
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
puppynewbie
Member
*
Posts: 4


View Profile
« Reply #6 on: January 18, 2008, 03:06:32 AM »

It's ok now. I uninstalled a few program. I adjusted setting in my firewall. Deleted Web Studio folder and reinstalled it again. Everything's ok now. Thanks
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!