0

how can I connect a HTML page that send parameter to a PHP page that should sort a DB through those parameters?

Basically I have a HTML form page with a drop down menu that send the name of a DB column. On the PHP I have tha code that access the DB but I can't figure out how to get those name and sort the DB through that name (or variable or flag).

I tried with a

  $name = $_POST['nameOfTheHtmlFormField'];

But the value of $name is NULL if I echo it.

Plus, I have no idea how to communicate that flag to a sort command in the PHP

Do you have any clue or resource I can look up?

Thank you.

1 Answers1

-1

Are you sure you want to be using $_POST? From what I understood from your post, you want to really be using the $_GET variable.

$_POST is for sending data to a script, for example a web form

$_GET is used to fetch the value of a parameter within a url, for example;

URL: /exampleScript.php?type=GetData&field=Username

echo $_GET['type']; // Outputs GetData
echo $_GET['field'] // Outputs Username

It seems like this is the issue with your script as I can't see why you want use a form as a link.

Jake Ball
  • 798
  • 2
  • 8
  • 26