Jump to content

Recommended Posts

<html>
<body>
<form name="form" action="index.php" method="post">
<input name="x" type="text">
<input name="y" type="submit" value="oK">
</form>
<?php
if (!empty($_POST)) {
    if (isset($_POST['x'])) {
        print $_POST['x'];
    }
    if (isset($_POST['y'])) {
        print $_POST['y'];
    }
} else {
    print 'tralala';
}
?>
</body>
</html>

I've modified your code slightly, see below.  The code is "working" how I would expect it to, it depends what you want it to do ...  You can see the below script running on my server at: 

 

http://www.computer-monitors.org.uk/test-simple.php

 

Rgds

 

<html>
<body>


<?php
$x=$_POST['x'];
if(isset($_POST['y'])) 
{
echo $x;
}
else {echo "tralala";} 
?>



<form name="form" action="<? echo $_SERVER['PHP_SELF']; ?>" method="post">
<input name="x" type="text">
<input name="y" type="submit" value="ok">
</form>



</body>
</html>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.