I am just getting started with PHP, so apologies if this question is elementary.
I have an HTML page called "index.html", which has forms for user input. After the submit button is pressed, the information is passed to a php script called "output.php".
From this point, users can continue to use the forms on the "output.php" page and get new calculation results.
This is all good, but say a user sends the URL to a friend (or "output.php" is loaded first). The URL copied from the address bar will be domain.com/output.php.
When the user loads this page, a series of errors occurs because none of the user information is there.
Is there a way to avoid this?
In my HTML I have set default values for the form inputs, but these are overridden by the PHP script.
I have also tried initializing the variables like this:
$value1 = 10;
$value1 = $_REQUEST['formvalue1'];
So that if there is no form value, 10 will be used. But this doesn't work.
I also tried a conditional like:
If ($REQUEST['formvalue1'] = NULL) {
$value1 = 10; }
Else
{$value1 = $REQUEST['formvalue1'];}
But this didn't work either.
Has anybody else stumbled onto this and can shed some light?
Many thanks,
Peter.