Can someone help me explain the coding?

if(isset($_SESSION['patron_ID']))
{ 
set_time_limit(0); 
include 'dbconnect.php'; 
$studylevel1 = $_POST['studylevel']; 
if(isset($_POST['submit'])) 
{ do 
    { 
    $senderid = $_SESSION['patron_ID']; $studylevel1 = $_POST['studylevel'];}}}
// execute the code below only if there is a patron_ID saved in the session variable
// this is probably a check if the user is logged in
if(isset($_SESSION['patron_ID']))
{
    // this function sets max execution time of the script
    // in your case (0) it sets no time limit 
    // see http://php.net/manual/en/function.set-time-limit.php
    set_time_limit(0);
    // here you include the file, probably to connect to the database
    // it is usually separate file so you can use it in many scripts
    include 'dbconnect.php';
    // what follows is an assignment from the session variable
    // this is one way of carying values over from script to script
    $studylevel1 = $_POST['studylevel'];
    // here you check (I presume) whether the form was submitted
    // only if it was, execute the code that folows
    if(isset($_POST['submit']))
    // probably part of a do/while loop
    { do
        {
            $senderid = $_SESSION['patron_ID']; $studylevel1 = $_POST['studylevel'];}}}

Hopefully this was clear enough :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.