3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // TEST CODE //echo "<input type=submit name=submitbtn3>"; //echo "<input type=submit name=submit900>"; //echo "<input type=submit name=submitbtn123>"; //echo "<input type=submit name=submitbtn33>"; //echo "<input type=submit name=submitbtn44>"; //echo "<input type=submit name=submitbtn55>"; // END TEST CODE if ($_POST['submitbtn3']) { // CAME FROM SELECT PATIENTPAGE $_SESSION['PATIENTID'] = $_POST['myselect3']; // GET CLIENT NAME $con=mysqli_connect("50.62.209.12:3306","Paul1","Welcome4$","Theravet"); $result = mysqli_query($con,"SELECT * FROM Clients WHERE ID='". $_SESSION['MYCLIENTSELECTED'] ."'"); while( $row = mysqli_fetch_array($result)) { $_SESSION['MYCLIENTNAMETEMP']= trim($row['First']); } mysqli_close($con); // ********************************************************************************* // TEMP FOR TESTING UNCOMMENT THIS PARAGRAPH AFTER TESTING IS COMPLETED 12-03-2015 // ********************************************************************************** //$con=mysqli_connect("50.62.209.12:3306","Paul1","Welcome4$","Theravet"); //if (mysqli_connect_errno()) // { // echo "Failed to connect to MySQL: " . mysqli_connect_error(); //} //$sql="UPDATE Patients SET ClientFirstName='". $_SESSION['MYCLIENTNAMETEMP']."' WHERE ID='" .$_SESSION['PATIENTID']. "'"; //if (!mysqli_query($con,$sql)) // { // die('Error: ' . mysqli_error($con)); // } // mysqli_close($con); PrevFormPosted(); } elseif($_POST['submit900']) { $allowedExts = array("gif", "jpeg", "jpg", "png","JPEG","JPG","GIF"); $temp = explode(".", $_FILES["file"]["name"]); $extension = end($temp); if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/pjpeg") || ($_FILES["file"]["type"] == "image/x-png") || ($_FILES["file"]["type"] == "image/png") || ($_FILES["file"]["type"] == "image/JPG") || ($_FILES["file"]["type"] == "image/JPEG") || ($_FILES["file"]["type"] == "image/GIF")) && ($_FILES["file"]["size"] < 500000) && in_array($extension, $allowedExts)) { if ($_FILES["file"]["error"] > 0) { //echo "Return Code: " . $_FILES["file"]["error"] . "<br>"; } else { if (file_exists("upload/" . $_FILES["file"]["name"])) { //echo $_FILES["file"]["name"] . " already exists. "; } else { $temp = explode(".",$_FILES["file"]["name"]); $file_name = date('d-m-y-H-i-s',time()) . '.' .end($temp); //$file_name = date('d-m-y-H-i-s',time()) . $_FILES["file"]["name"]; move_uploaded_file($_FILES["file"]["tmp_name"],"upload/" . $file_name); // UPDATE WITH NEW DATA $con=mysqli_connect("50.62.209.12:3306","Paul1","Welcome4$","Theravet"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } mysqli_query($con,"UPDATE Patients SET ImgName='".$file_name."' WHERE ID='".$_SESSION['PATIENTID']."'"); mysqli_close($con); //echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } } else { //echo "Invalid File"; } PrevFormPosted(); } elseif($_POST['submitbtn123']){ // comes back from patient upload image PrevFormPosted(); } elseif($_POST['submitbtn33']) { //exit added this line 1/12/2015 ThisFormPosted(); ?> <?php //<meta http-equiv="refresh" content="1;url=Menu.php"> ?> <?php } elseif($_POST['submitbtn44']) { MyCancel(); } elseif($_POST['submitbtn55']) { } else { ThisFormPosted(); } ?> <?php //function ThisFormPosted(){ // echo "This form posted function"; //} ?>
Output for 7.0.0 - 7.2.0
Notice: Undefined index: submitbtn3 in /in/FUqmc on line 18 Notice: Undefined index: submit900 in /in/FUqmc on line 54 Notice: Undefined index: submitbtn123 in /in/FUqmc on line 104 Notice: Undefined index: submitbtn33 in /in/FUqmc on line 108 Notice: Undefined index: submitbtn44 in /in/FUqmc on line 119 Notice: Undefined index: submitbtn55 in /in/FUqmc on line 122 Fatal error: Uncaught Error: Call to undefined function ThisFormPosted() in /in/FUqmc:125 Stack trace: #0 {main} thrown in /in/FUqmc on line 125
Process exited with code 255.
Output for 5.5.0 - 5.6.28
Notice: Undefined index: submitbtn3 in /in/FUqmc on line 18 Notice: Undefined index: submit900 in /in/FUqmc on line 54 Notice: Undefined index: submitbtn123 in /in/FUqmc on line 104 Notice: Undefined index: submitbtn33 in /in/FUqmc on line 108 Notice: Undefined index: submitbtn44 in /in/FUqmc on line 119 Notice: Undefined index: submitbtn55 in /in/FUqmc on line 122 Fatal error: Call to undefined function ThisFormPosted() in /in/FUqmc on line 125
Process exited with code 255.