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
https://forums.phpfreaks.com/topic/243161-i-cannot-post-anything-to-the-next-page/
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;

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.