Problem with post

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fozzy
Forum Newbie
Posts: 2
Joined: Mon Aug 18, 2003 9:35 am

Problem with post

Post by fozzy »

I've a really problem.....
look my exemple:
###################teste.php
<html>
<body>
<form action="teste2.php" method="post" enctype="multipart/form-data">
<input type="text" name="texto">
<input type="submit" value="ok">
</form>
</body>
</html>

######################teste2.php
<?php
$string = $_POST['texto'];
echo "Var em post: ".$string."<br>";
echo "Var em get: ".$_GET['texto']."<br>";


//phpinfo();
?>


I dont can get the value from the posted variable....
What I can do?? :?: :?: :?: :?:

TNX
Klaus Kaiser
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

If you have regitster globals off, an easy way of reading all the variables from a submitted form is to use this:

Code: Select all

extract($_POST);
This function is used to import variables from an array. It takes an associative array and treats keys as variable names and values as variable values.
User avatar
Jean-Yves
Forum Contributor
Posts: 148
Joined: Wed Jul 02, 2003 2:13 pm
Location: West Country, UK

Post by Jean-Yves »

Hi Klaus,

Are you sure that you mean the $_POST array variable? Your code works fine for me. However, the $_GET array variable won't display since nothing is coming across on the URL. Or was that just for debugging?

If you did mean $_POST, then I'm guessing that there's a problem in your php.ini file

try also:

Code: Select all

if(!isset($_POST&#1111;"texto"]))
  die("NOT SET!");
this will determine if the variable is actually being passed to the second page.
Post Reply