Re: Forms NOt Wokring after upgrade top 8.1
| From: | Ed Greenberg | Date: | Mon, 16 Jan 2023 01:02:33 +0000 |
| Subject: | Re: Forms NOt Wokring after upgrade top 8.1 | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-328130@lists.php.net to get a copy of this message | ||
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@lists.php.net>
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@gmail.com> 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@lists.php.net> 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.
>
>