Page 1 of 1
Need some help with some basic stuff
Posted: Sun Nov 12, 2006 3:52 pm
by jm999
I have posted a few times about a site I'm currently building. Basically its a gift registry where people can sign up and add links to products to their personal registry page. I have the database set up and everything is working properly. Now I need to set up the page where visitors can view the registries. I have no idea how to go about it. Could anyone help me get going in the right direction?
Posted: Sun Nov 12, 2006 3:59 pm
by aaronhall
Posted: Sun Nov 12, 2006 4:09 pm
by jm999
Thanks for the reply. I guess I should have been more specific. I have already set up forms to register and insert the information for the individual registrants. Now I need to create the page where a visitor can look at individual registries. I'm not sure how to go about that. I'll have a search feature where a visitor can search for a registrant by first and last name, but I need a page to link to that will display their registry.
The registrant also invites guests via email automatically upon registration. The email will contain a link to their registry for their guests to go to. I'm just at a loss as to how I create that page.
Posted: Sun Nov 12, 2006 5:10 pm
by jm999
In a previous post I was told that the page would be something like "
http://www.thesite.com/view_registry.php?userid=1".
What exactly does the view_registry page need to do in order to recognize the "userid=1" ?
Posted: Sun Nov 12, 2006 5:11 pm
by jayshields
Posted: Sun Nov 12, 2006 5:32 pm
by jm999
Ok, I looked at that. How can the view_registry page take the "1" and put that into a variable in order to display the information?
I just want the page to get the information based on the userid in the url. Is that possible? Or is the variable already established by putting in the "?userid=1" ?
Posted: Sun Nov 12, 2006 5:40 pm
by feyd
There is a variable established when you have ?userid=1 in the URL (given correct placement) for userid. As jayshields points out, it would be in the $_GET superglobal.
Posted: Sun Nov 12, 2006 5:45 pm
by jm999
Thanks for the tips. I got it now. So adding the "?userid=1" allows you to access the "1" with $_GET['userid'], right?
Posted: Sun Nov 12, 2006 5:55 pm
by aaronhall
Correct. Before you stick that straight into your query, though, be aware that the user can stick anything into that variable, including quotation marks. Always "sanitize" your variables with
mysql_real_escape_string.
Posted: Sun Nov 12, 2006 6:34 pm
by jm999
Awesome. I finally feel like I'm getting somewhere. Thanks a bunch for all of your help. My next issue is with the search function. People will have the ability to search the registries by first name and last name. This will ultimately bring up multiple registries. How do I link the results to their corresponding userid?