Bottom posting is the convention so please see my comments below:

Dan Aloma wrote:

I would love for it to return something. That's what I really want. But it doesn't return anything. I used that new script you wrote, and it does the same thing. It just refreshes itself, and sometimes it just goes to white. Very strange. No one has been able to solve this, like I said. Thanks for the help.


From: Chris Hewitt <[EMAIL PROTECTED]>
To: Dan Aloma <[EMAIL PROTECTED]>
Subject: Re: [PHP-INSTALL] Php not taking input from html
Date: Wed, 07 Apr 2004 19:51:13 +0100

Dan Aloma wrote:

Something is DEFINITELY wrong here...shouldn't this peice of code being working? I get no errors when I turn on error logging in php.ini, so what in the world is going on???? I have been on every board, and every user-list and no one has been able to figure it out. I don't understand. Thanks for the help though.

CODE:
<?php
if ($_POST['submit']) {
  print "the form has been submitted";
}
?>

<html>
<body>

<br><br>
<?=$errormessage?>
<br>

<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<table width="500" border="0" cellpadding="5" cellspacing="0">
<tr><td>Your name:</td><td><input type="text" name="name" value="<?=$_POST['name']?>"></td></tr>
<tr><td>Your email:</td><td><input type="text" name="email" value="<?=$_POST['email']?>"><td><tr>
<tr><td>Your message:</td><td><textarea name="message"><?=$_POST['message']?></textarea></td></tr></table>
<input type="hidden" name="required" value="name,email,message">
<input type="submit" name="submit" value="submit">


</body></html>

END CODE


Dan,

You do not say what you expect to happen and what you have tried. I've added the head /head tags just to be "correct", and moved the post message within the body so it will display. I've put it into a file in a directory where php is enabled. I have register_globals off and short_tags off so I've put the long php starting tags in.

If I then clicked the submit button your "form has been submitted" message appears but not the data in the text boxes. This is because you did not ask for them to be put there by echoing the values of the posted data.

So my version is similar to yours, but its the little differences. Code below.

Regards

Chris

<html>
<head>
</head>
<body>
<?php
if ($_POST['submit']) {
 echo "the form has been submitted";
}
?>

<br><br>
<?=$errormessage?>
<br>

<form action="<?php $PHP_SELF ?>" method="post" name="myform">
<table width="500" border="0" cellpadding="5" cellspacing="0">
<tr><td>Your name:</td><td><input type="text" name="name" value="<?php echo $_POST['name']?>"></td></tr>
<tr><td>Your email:</td><td><input type="text" name="email" value="<?php echo $_POST['email']?>"><td><tr>
<tr><td>Your message:</td><td><textarea name="message"><?php echo $_POST['message']?></textarea></td></tr></table>
<input type="hidden" name="required" value="name,email,message">
<input type="submit" name="submit" value="submit">
</form>
</body></html>

If you still get nothing then probably php is not enabled in the directory you have put the script in (I'm assuming you copy/pasted my entire version, not just edited yours). Either that or the filename extension you are using is not one that you have set the webserver to be parsed by PHP. To test this you could add a line within the body that unconditionally will echo something to the browser, e.g.:
<?php echo "php is working" ?>
Now if that does not show then php is not enabled in that directory. Another test is the classic phpinfo.php file that contains:
<?php phpinfo(); ?>
which gives information about the settings for PHP etc.


Under the conditions here (Linux/Apache httpd/PHP) my version of the script does work. If it does not work under the conditions you have then it is your setup for PHP that needs tweaking. I suggest you try the two suggestions above and post the results to the list. It would then also be useful to tell us something about your setup (OS, webserver, PHP version, browser etc). I think it will turn out to be something simple in the end.

Hope this helps.

Chris

Reply via email to