Re: Forms NOt Wokring after upgrade top 8.1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You need quotes around the constant, number, within the subscript to the $_POST variable.  $_POST['number'] will do it. PHP7 would look at the bare string and decide that it needed to be quoted. Later versions of PHP7 through a warning that it was deprecated. Now it's gone. If it's a string, quote it.



On Sun, Jan 15, 2023, 19:50 JB via php-general <php-general@xxxxxxxxxxxxx> wrote:
I am probably being VERY stupid is all. but even a VERY basic form does not work...

<?
$test = $_POST[number];
echo $test;
?>
<br>
<form action="" method="post" name="testfrom">
NUMBER: <input type="text" id="number" name="number">
<input type="submit" value="Send Number">
</form>


This returns an error

[16-Jan-2023 00:38:35 UTC] PHP Fatal error: Uncaught Error: Undefined constant "number" in /home/mrbill/public_html/x.php:6
Stack trace:
#0 {main}
thrown in /home/mrbill/public_html/x.php on line 6
[16-Jan-2023 00:38:36 UTC] PHP Fatal error: Uncaught Error: Undefined constant "number" in /home/mrbill/public_html/x.php:6
Stack trace:
#0 {main}
thrown in /home/mrbill/public_html/x.php on line 6
[16-Jan-2023 00:49:01 UTC] PHP Fatal error: Uncaught Error: Undefined constant "number" in /home/mrbill/public_html/x.php:6
Stack trace:
#0 {main}
thrown in /home/mrbill/public_html/x.php on line 6

On Sunday, January 15, 2023, 07:40:38 PM EST, Aziz Saleh <azizsaleh@xxxxxxxxx> wrote:


Can you provide more info including:

- Current server settings/installation versions + if it was changed recently?
- What is the script logic you are using (html and the PHP backend logic).
- Online examples if any.

Thanks!

On Sun, Jan 15, 2023 at 7:37 PM JB via php-general <php-general@xxxxxxxxxxxxx> wrote:
I had several forms on a client's web site that emailed the input to that client.  They all worked fine in 7.4 but now that the server has been , neither one reads the form post data.  Any suggestions to fix this.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux