Jump to content

[SOLVED] can a query be used with a form?


Thundarfoot

Recommended Posts

I am using this query to return all records from a mysql table that contain the value bob in the class column of the db table.

 

I was about to make a bob.php, steve.php, and nancy.php using the same code below except changing the LIKE 'Bob%' to either steve or nancy.

 

then learn to make a form to chose between bob, steve, or nancy.(about 75 diffrent names)

 

However, I am thinking that it should be possible to make the LIKE 'Bob%' a varriable read from a selection box or something, just not sure..

 

Anyway this is the query, can Bob be replaced with form output or something? Thank you for your time.

 

 

$query_ClassSelect = "SELECT Name, `Class`, Days, Comments, Pic FROM table WHERE table.`Class` LIKE 'Bob%' ORDER BY Name ASC";

Link to comment
https://forums.phpfreaks.com/topic/86218-solved-can-a-query-be-used-with-a-form/
Share on other sites

Thank you

 

No I haven't created the form yet, in fact I don't know how to make the form yet, I will have to learn. but did not want to get sidetracked off my project to try to make the form, if It wasent going to work the way I wanted.

 

On a side note I think its neat that I could see the fact I could use a variable there, even not knowing how...to me it means my grasp of the language is improving..

 

Anyway again thanks for the explanation!

Here's an basic example of the form.  Make sure this is below the php code I gave you earlier

 

<form name="form" id="form" action="index.php" method="post" enctype="multipart/form-data">
<select id="name" name="name"><option value="bob">Bob</option><option value="steve">Steve</option></select>
<input type="submit" value="Submit" />
</form>

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.