Jump to content

php sorting with html


astani

Recommended Posts

Hi,

 

I am a php newbe I have a Posgresql db and am trying to do a sort routine based on project titles or project owners. I have an html dropdown for this. I have an array that displays the letters of the alphabet and would like to be able to pick from the dropdown and populate the names of projects alphabetically or names of projects by creator.

Here is what I have so far, the queries don't seem to work or maybe just not displaying, any help would be apreciated.

 

<h4 align="left">Sort By: </h4>

<form name="jump">

<p align="left">

<select name="menu">

<option value="URL"> Project Name</option>

<option value="URL"> Owner</option>

</select>

<?php $sort_query = pg_query("SELECT * FROM projects ORDER BY title");

$projByTitle = pg_fetch_array($sort_query);

$sort_query1 = pg_query("SELECT * FROM users ORDER BY username");

$projByOwner = pg_fetch_array($sort_query1);

?>

<input type="button" name="<?php if (jump.menu.selectedIndex == "0") { echo "$projByTitle"; } else { echo "$projByOwner"; } ?> " method = "post" value="GO">

 

Thanks,

Andy

Link to comment
https://forums.phpfreaks.com/topic/124373-php-sorting-with-html/
Share on other sites

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.