Jump to content

I cannot post anything to the next page.


ferlicia

Recommended Posts

I cannot post anything to the next page. Why? I tried to echo out but nothing came out. This is my code for the form,

 

<div style="position: absolute; left:340px; top:150px;">

      <form name="Form1" method="post" action="doAddManual.php">

          <?php

          include "dbFunctions.php";

          $query = mysqli_query($link, "Select studentID from criteria");

          ?>

          <p><label for="addcri">criteria: </label>

                        <input name="criteria" type="text"></p>

          <?php

 

          for($i=0; $i<25; $i++){

              ?>

              <?php while($row = mysqli_fetch_array($query)){

                  echo "student ID: $row[0]";

          ?>

                    <p><label for="addcri">Student's criteria: </label>

                        <input name="addcri" type="text"></p>

 

          <?php

              }

          }

          ?>

                    <p><input name="btnsubmit" value="Submit" type="submit"></p>

</form>

 

 

this is where it is posted to,

<?php

 

include 'dbFunctions.php';

$query_1 = mysqli_query($link, "Select studentID from criteria");

$row = mysqli_fetch_array($query_1);

 

$criteria = $_POST['criteria'];

$addcri = $_POST['addcri'];

 

for($i=0; $i<$row; $i++){

    $query = mysqli_query($link, "Update criteria set $criteria = $addcri where studentID = $row[0]");

    $status = mysqli_query($link,$query) or die(mysqli_error($link));

}

 

if($status){

    $message = "criteria addded sucessfully";

}

else{

    $message = "Unable to add criteria";

}

 

echo $criteria;

Link to comment
Share on other sites

ferlicia, I feel you need to learn how to do a simple echo. I've seen several of your posts and you make great confusions out of little things, if you start echo(ing) out your variables, you'll find it much easier to figure out where the problems are.

 

In this particular case, your subject is: "I cannot post anything to the next page.", so even though your code has many other problems, I'm going to focus on that specific question.

Down in your code, you have this:

$criteria = $_POST['criteria'];
$addcri = $_POST['addcri'];

(that grabs the values posted to the page)

In your form, you actually have elements with these names (<input name="criteria" type="text"> and <input name="addcri" type="text">) and your form method is "post", that means everything is fine!!!

so if you echo out the variables, you'll see they ARE being posted (unless you're posting to the wrong file).

 

echo $criteria .'<br>'.$addcri;

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.