3v4l.org

run code in 300+ PHP versions simultaneously
<?php include_once("../includes/db_connect.php"); $topic = $_POST['topic']; $query = $mysqli->query("select * from topic_answer where topic_name = '$topic' "); echo "<form action='#' method='POST'>"; echo '<input type="hidden" name="topic" value="' . $topic . '"/>'; echo '<label> Question </label>'; echo '<input type="text" id="Question" name="Question">'; echo '<br>'; echo '<label> is this a yes or no response? </label>'; echo '<select name="yes_no"> <option value=""></option> <option value="yes">yes</option> <option value="no">no</option> </select> '; echo '<br>'; echo '<label> Parent question </label>'; echo "<select name='parent'>"; while($obj = $query->fetch_object()){ echo $obj->id; echo "<br>"; echo $obj->topic_name; echo "<br>"; echo $obj->topic_question; echo "<br>"; echo "<option value='" . $obj->id . "'>" . $obj->topic_question . "</option>"; } echo '</select>'; echo '<button type="submit" name="submit" id="submit" value="submit">Submit</button>'; echo "</form>"; echo "<br>"; if(isset($_POST['submit'])){ $question = isset($_POST['Question']); $yes_no = isset($_POST['yes_no']); $parent = isset($_POST['parent']); if(empty($question)){ echo "error: question not set"; var_dump($question); }elseif(empty($yes_no)){ echo "error: yes or no not set"; } elseif(empty($parent)){ echo "error: parent not set"; } else{ $question = $_POST['Question']; $yes_no = $_POST['yes_no']; $parent = $_POST['parent']; if($yes_no === "yes"){ $yes = 1; $no = 0; }else{ $yes = 0; $no = 1; } $creator = "jordan"; $start = 0; $end = 0; var_dump($question); var_dump($yes_no); var_dump($parent); $insert = $mysqli->prepare("INSERT INTO topic_answer (topic_name, topic_creator, topic_question, load_yes, start, load_no, end, parent) values(?,?,?,?,?,?,?,?)"); $insert->bind_param('sssiiiii', $topic, $creator ,$question,$yes,$start,$no,$end,$parent); $insert->execute(); $insert->close(); } }
Output for git.master, git.master_jit, rfc.property-hooks
Warning: include_once(): open_basedir restriction in effect. File(../includes/db_connect.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/2emfO on line 3 Warning: include_once(../includes/db_connect.php): Failed to open stream: Operation not permitted in /in/2emfO on line 3 Warning: include_once(): Failed opening '../includes/db_connect.php' for inclusion (include_path='.:') in /in/2emfO on line 3 Warning: Undefined array key "topic" in /in/2emfO on line 5 Warning: Undefined variable $mysqli in /in/2emfO on line 7 Fatal error: Uncaught Error: Call to a member function query() on null in /in/2emfO:7 Stack trace: #0 {main} thrown in /in/2emfO on line 7
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
67.87 ms | 402 KiB | 8 Q