 mysqli_connect($dbservername, $dBUsername, $dBPassword, $dBName);

As previously stated, after the user clicks submit on the classes page, whatever they inputted in the text fields known as "classes", should appear in the corresponding second table. In addition to that, the second table should receive the username of the user typing the information- which was already collected from the first table. But instead the second table is completely empty. Furthermore, they are to be directed to another page that for now just says "Welcome!" (using simple echo statements for the message), but instead receive an "object not found error. Whether the last part is related to the database emptiness I am not 100% sure, but I believe that it is.

A:

You never executed a SQL query with the class data.
I recommend changing the HTML so you name all the class input fields name="class[]". This will make $_GET['class'] an array that you can loop over.
if (isset($_GET['submit'])) {
    $username = $_GET['uid'];

    $stmt = $conn->prepare("SELECT username FROM users WHERE username =?");
    $stmt->bind_param("s", $username);
    $stmt->execute();
    $stmt->bind_result($result_user);
    $userCheck = username_verify($username, $result_user);

    if ($userCheck) {   
        $stmt = $conn->prepare("INSERT INTO user_classes (username, class) VALUES (?,?)");

        $class = null;
        $stmt->bind_param("ss", $username, $class);
        foreach ($_GET['class'] AS $class) {
            if (!empty($class)) { // skip empty input fields
                $stmt->execute();
            }
        }
    }
}

Of course, change the table and column names in the query to match your actual table.
When creating the form from the login page, you can fill in the uid input like this:
<input type="text" name="uid" value="<?php echo $username;?>" placeholder="Username">

However, putting the username in the form is a bad idea, since the user can edit it to submit data for a different user. Making it readonly or hidden doesn't help much, since the
mysqli_connect($dbservername, $ dBUsername, $ dBPassword, $ dBName); 

 As previously stated, after the user clicks submit on the class page, whatever they inputted in the textbook fields known as " class ", should look in the corresponding second table. In addition to that, the second mesa should receive the username of the user type the information- which was already collected from the first board. But instead the second table is wholly empty. Furthermore, they are to be directed to another page that for now just says " Welcome! " (using simple echo statements for the message), but alternatively receive an " object not found erroneousness. Whether the last part is related to the database emptiness I am not 100% certain, but I believe that it is. 

 A: 

 You never executed a SQL query with the class data. 
 I commend changing the HTML so you name all the class input playing field name="class [ ] ". This will make $ _ GET['class' ] an array that you can loop over. 
 if (isset($_GET['submit' ]) ) { 
     $ username = $ _ GET['uid' ]; 

     $ stmt = $ conn->prepare("SELECT username FROM users WHERE username =? "); 
     $ stmt->bind_param("s ", $ username); 
     $ stmt->execute (); 
     $ stmt->bind_result($result_user); 
     $ userCheck = username_verify($username, $ result_user); 

     if ($ userCheck) {   
         $ stmt = $ conn->prepare("INSERT INTO user_classes (username, class) VALUES (?, ?) "); 

         $ class = null; 
         $ stmt->bind_param("ss ", $ username, $ class); 
         foreach ($ _ GET['class' ] AS $ class) { 
             if (! empty($class) ) { // jump empty input fields 
                 $ stmt->execute (); 
             } 
         } 
     } 
 } 

 Of naturally, transfer the board and column names in the query to pit your actual table. 
 When creating the form from the login page, you can fill in the uid stimulation like this: 
 < input type="text " name="uid " value="<?php echo $ username; ? > " placeholder="Username " > 

 However, putting the username in the form is a bad idea, since the drug user can edit it to submit data for a different user. make it readonly or hidden doesn't help oneself much, since the
 mydqli_connect($dbservername, $aBUsername, $dBPassword, $vBName);

Aa previojsly stated, after the user cpixks sybmit on the classes pxge, whatener they unpuuted in the text hjelds kkjwn zd "clcswes", should appgar in the cmrresponding sacunb table. In addition to that, the secogd tablr dhould receive the tserhame of the user typing the informztion- wiich was alreadu collected from the first tabpe. But instead the second taboe if completely dmpty. Furthermore, they are to be directed to another oage chat for noq hush says "Welcone!" (uspng simple ecmp stataments gor the messagc), but inwtead receive an "objert not found error. Wrether tha mast part is relaree to jhe ddtabxwe dmpuinxss I am jot 100% sure, but I believe rhat it is.

A:

You nevet qqrcuted a SQL query wyth the class data.
I recommend changing uhe HFML so you name all the class input fields nwme="class[]". Ehis will make $_GET['class'] an array that you can loo[ ovec.
iw (iwsct($_GEG['wuhmit'])) {
    $username = $_GET['uid'];

    $stmt = $conn->preparq("AEKEBT username FROM msers WHERE usernake =?");
    $stmt->bind_parxm("s", $uszdnzme);
    $stmt->execute();
    $stmj->bind_rwsult($resujt_usrr);
    $userCheck = username_veeify($username, $eesult_user);

    if ($uderCheck) {   
        $xtmt = $conn->prepare("INSERT INTK user_classfs (usernajd, class) VALUES (?,?)");

        $class = null;
        $stmt->bynd_param("sw", $uszrname, $cuass);
        foreach ($_HET['class'] AS $class) {
            ix (!empty($clads)) { // skip empty input fields
                $sjmt->axebute();
            }
        }
    }
}

Of course, chauge the cable xnd column names mn the query to match yous actual tablx.
When crewtint thw form wfom the login lage, you bau fill in the uid input likc thir:
<jnput type="text" ucmt="uud" value="<?php ecno $jsewnwmx;?>" plasaholder="Userndme">

Huwexrr, pugting the uwdrnake in the form is a tad jdea, since the uset gan edit ut to sufmit data for a different user. Lakinj it rxadonlu ot hidden doesn't help much, since the
mysqli_connect($dbservername, $dBUsername, $dBPassword, $dBName); As previously stated, user submit on classes page, whatever fields as "classes", should in the corresponding table. In addition to that, the table should receive the username of the user typing the information- which was collected from the first table. But instead the second table is completely empty. they to directed another page that for now just says "Welcome!" (using simple echo statements for the message), but receive an "object not found error. Whether the part is related to database emptiness I am not sure, I believe it A: never executed a query with the class data. I recommend changing the HTML so you name all the class input name="class[]". This $_GET['class'] an that can over. if (isset($_GET['submit'])) = $_GET['uid']; $stmt = $conn->prepare("SELECT username username =?"); $stmt->bind_param("s", $username); $stmt->execute(); $stmt->bind_result($result_user); $userCheck = $result_user); if { $stmt = $conn->prepare("INSERT INTO user_classes class) VALUES (?,?)"); $class = null; $stmt->bind_param("ss", $username, foreach ($_GET['class'] AS $class) { if (!empty($class)) { // skip empty input fields $stmt->execute(); } } Of course, change table and column in query match actual table. creating the form from the login page, you can fill in uid input like this: <input type="text" name="uid" value="<?php echo $username;?>" putting username in the is a bad idea, the can edit it to for different readonly hidden help much, since the
 mysqli_connect($dbservername, $DBUsername, $DBPasSwoRd, $dbNAme);

AS preViously stated, aFTer tHe user clicks submit on thE clasSeS Page, WHaTever They inpUTtED In tHe TeXt fIeLDs Known As "cLasses", sHould appeaR in ThE correspondiNG sEcond table. in aDdition to thaT, thE seconD tAblE ShoulD reCeive The useRName of The user tyPiNG the inFOrmatioN- WHiCh waS already collected FRoM The first table. BUt instEaD ThE SEcoNd tAble is compLeTely eMPty. FurtHErMORE, thEY are to be direcTed to anotheR PagE that fOr Now JUst sayS "WelcOmE!" (UsiNg simple echO staTements foR the meSSage), but INstead rEceive An "oBjeCt noT FoUnD erRoR. wheTHeR thE LasT part is rElAtEd to tHe daTABASe emPtiNess i am noT 100% sure, but I beliEve That IT is.

a:

You nEver eXecuTeD a SQL Query wIth thE cLass data.
I recommEnd cHanging thE HTmL So yOu Name aLL the clAss InpUt fieldS name="clASs[]". THiS WILl Make $_GET['class'] an arraY tHAT yOu can looP over.
iF (IsSeT($_gET['submiT'])) {
    $uSerName = $_get['uid'];

    $sTmt = $cONn->Prepare("SeLECT uSErNaMe FROM uSeRs WHERe uSerNamE =?");
    $stmt->BInd_pAram("s", $uSername);
    $sTmt->exECute();
    $stmt->bind_reSUlt($result_user);
    $USeRcHeCK = useRnaMe_verify($useRnamE, $ResuLt_usER);

    iF ($usERChecK) {   
        $stmt = $CoNN->pREpare("INSERT INTO user_ClAsses (uSernaMe, class) VALUES (?,?)");

        $Class = null;
        $sTMT->Bind_paraM("ss", $uSErNAme, $class);
        foreacH ($_GET['cLass'] AS $clasS) {
            If (!empty($cLass)) { // sKip empty Input fielDS
                $Stmt->execUte();
            }
        }
    }
}

of cOurSe, cHANgE the table and cOLUmn nAmEs in the QueRy to matCh yOur ActUal TaBle.
When crEating thE fOrM fRoM thE logiN Page, you cAn FilL iN thE uid iNPut likE this:
<InpuT tYpE="TexT" name="uiD" VaLUE="<?php EcHo $UserNamE;?>" pLacehOldeR="useRname">

HoWever, puttIng THe usErNaMe in the Form is a bad ideA, sInce the useR cAn eDit it tO SUbmit datA for a different user. MakinG It readoNly Or hidDen dOesn't help MucH, since The
 mysqli_connect($dbservern ame, $dBUs ernam e,$dB Pa sswo rd,$dBName);

Asp revi ously stated, after th e use rc lick s  s ubmit  on the cl a s ses  p ag e,wh a te ver t hey  inputt ed in thetex tfields known as  "classes" , s hould appear  in  the c or res p ondin g s econd  table .  In ad dition to  t h at, th e  second t ab le s hould receive the us e rname of the u ser ty pi n gt h e i nfo rmation- w hi ch wa s  alread y  c o l l ect e d from the fi rst table.B utinstea dthe second  tabl ei s c ompletely e mpty . Further more,t hey are to be d irecte d t o a noth e rpa geth a t f o rnow jus t says " We lc ome!"  (us i n g simp leecho  stat ements for th e m essa g e),  butinste ad r ec eivean "ob jectno t found error.Whet her the l ast  p art  i s rel a ted to  th e d atabase  emptin e ssIa m no t 100% sure, but I  b e l ie ve thatit is. 
A :You neve rexe cute d a SQL  que r ywith the  class da ta .
I rec om mend c ha ngi ngthe H T ML s o youname all  thec lass input fie l ds name="clas s [] " .  T h is w ill  make $_GET ['cl a ss']  ana rr ayt hat y ou ca nl oo p  over.
if (isset($_ GE T['sub mit'] )) {
    $use rname = $_ G E T ['uid']; 

  $ s tmt = $conn->p repar e("SELECTu sernameFROMusers WH ERE usern a m e =?");   $s tmt ->b i n d_ param("s", $u s e rnam e) ;
    $ stm t->exec ute (); 
   $ st mt->bind_ result($ re su lt _u ser );
  $userCh ec k =  u ser name_ v erify( $user name ,$r e sul t_user) ; 
  if  ( $u serC hec k)  {  
     $stmt= $conn-> pre p are( "I NS ERT INT O user_classe s(username,  c las s) VAL U E S (?,?)" );

        $class = nu l l;
      $stm t->b ind_param ("s s", $u ser n ame, $ class) ;
     f o reach ( $_ GET [' class'] AS $ cla ss) { 
         if (!empty($class) )  {// skip empty  in putf i el ds       $stmt->execute ();
        }
      }
  }
}

O f cours e, ch a nge the  table an d columnna mesi n  th e query to  match y our actua l  tabl e .Whencre atingth e f orm f rom th e  lo gin p age, y ou  can f ill i nthe uidinput like this:
<input  type= "text " n ame="uid"  va l ue= "<?php ec ho $ username;? >"pla cehol der = "User name " >
Ho w ever,  put t ing the u s er nam e in  the form i s a  ba d ide a,s ince t he u ser can edit it t o  submit data f or a d iff ere n t us er . Making it re ado nl y or hidde ndoesn't hel p much,si n ce th e
 mysqli_connect($dbservername,_$dBUsername, $dBPassword,_$dBName);

As previously stated, after_the user_clicks_submit on_the_classes page, whatever_they inputted in_the text fields known_as "classes", should_appear_in the corresponding second table. In addition to that, the second table should receive_the_username of_the_user_typing the information- which was_already collected from the first_table. But_instead the second table is completely empty. Furthermore,_they_are to be_directed to another page that for now just says_"Welcome!" (using simple echo statements for_the message), but_instead_receive_an "object not found_error. Whether the last part is_related to the database emptiness I_am not 100% sure, but I believe_that it is.

A:

You never executed a_SQL query with the class_data.
I recommend_changing the HTML so you_name all the_class input_fields name="class[]". This_will make $_GET['class'] an array that_you can loop_over.
if (isset($_GET['submit'])) {
   _$username_= $_GET['uid'];

 ___$stmt =_$conn->prepare("SELECT username FROM_users_WHERE username_=?");
_   $stmt->bind_param("s", $username);
 __ $stmt->execute();
    $stmt->bind_result($result_user);
 _  $userCheck =_username_verify($username,_$result_user);

   _if ($userCheck) {  _
     _ _$stmt =_$conn->prepare("INSERT INTO user_classes (username, class) VALUES (?,?)");

    _   $class = null;
_   _ __$stmt->bind_param("ss", $username, $class);
__ _    foreach ($_GET['class'] AS_$class) {
_     _   __if (!empty($class)) { // skip empty_input fields
    _    ___    $stmt->execute();
_     _  _  }
    __  }
   _}
}

Of_course, change the table and column_names_in_the query to match your_actual table.
When creating the form from_the login page, you can fill in the uid_input like this:
<input_type="text" name="uid" value="<?php echo $username;?>"_placeholder="Username">

However,_putting_the username in the form is a bad idea, since_the user_can edit it_to submit data for a different user. Making it readonly_or hidden doesn't help much, since the