I have a names database with only 4 fields (Sex, Origin, Meaning, Starts With) and html search form for those same 4 fields. Can anyone give me the php code so that if anyone fills in any or all of the form fields, the results from the database will be produced on the same page as the search form.
phpNewbie 0 Newbie Poster
Recommended Answers
Jump to PostHi, you can have php code
<?php echo $_SERVER['PHP_SELF'];?>
on your form action to return the results in the same page.
and in the top of your page(the same page with the form), add conditional statements for all/any or search form fields and then query them …
Jump to Postwith that... try to search tutorials on google.. try website like w3schools.com, tizag.com.. there are many examples there.. including php and mysql for your data fetching.. when your done, post it quick here …
Jump to PostWell now my go.
I have done something very very similar.
No you cannot have the code. It is MUCH MORE FUN it you work it out for your self.
For a start something that the previous posters forgot, what happens if more than one matching row …
Jump to Post.. hey phpNewbie.. umm the sites i gave was a great help.. i am also a self taught coder.. i only search , read forums.. and it gave so much more than i think of..
it's easy to paste the code here but you have to learn it a …
All 15 Replies
enim213 1 Light Poster
phpNewbie 0 Newbie Poster
enim213 1 Light Poster
almostbob 866 Retired: passive income ROCKS
phpNewbie 0 Newbie Poster
almostbob 866 Retired: passive income ROCKS
pclfw 23 Junior Poster
phpNewbie 0 Newbie Poster
enim213 1 Light Poster
almostbob 866 Retired: passive income ROCKS
phpNewbie 0 Newbie Poster
phpNewbie 0 Newbie Poster
wacmo 0 Newbie Poster
aprillyn.ruado 0 Newbie Poster
tqmd1 0 Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.