• 0
Votes
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 195

Backtrace:

File: /home/u125378470/domains/lawhelpguru.org/public_html/application/views/question.php
Line: 195
Function: _error_handler

File: /home/u125378470/domains/lawhelpguru.org/public_html/application/controllers/Questions.php
Line: 416
Function: view

File: /home/u125378470/domains/lawhelpguru.org/public_html/index.php
Line: 315
Function: require_once

after I press submit button page will automatically reloads before I store that input variable to database and if that inputted variable will equal 'sunny' then this form wont show again. So basically if I submit input text with 'sunny' inside then I won't be able to see it again. I have tried to place header() function inside isset() function but I got error due during reload..

//2. We pick from database weather which eqauals to sunny and assign it to variable $weather
$weather = '';

if (weather != 'sunny') {
    echo "<form method='post'>";
    echo "<input type='text' name='weather' required />";
    echo "<input type='submit' name='submit' value='SEND' />";
    echo "</form>"; 
}

if (isset($_POST['weather'])) {
    $_POST['weather'] //1. This variable equals sunny and we store it to database
}