Posted on: 04/29/04 04:06pm
By: Nav
Hey everybody,
I'd like to create a static page with a text field and a submit button, when the user types something into the text field and hits submit, i'd like it to insert the text into a table in my mysql db. I know how to do the inserts/etc on the db side of things, but I have no idea how to go about making a static page with a form on it which would pass the information. Can anyone give me some code for a very simple static page which does something similar? Or otherwise a phpblock which does something similar (something very simple?) I tried looking at the chatterblock code but that is way beyond me. Preferentially, I'd like to go with the option of a phpblock though.
Thanks,
Nav
a static page with a form?
Posted on: 04/29/04 05:25pm
By: machinari
doing the form up is just basic html and so you can view source of a form on the net to see an example or even a wysiwyg will do a form for you. then just paste the code into your static page. but to put the data into a db, you will prolly want to write a bit of php for that. and on a static page you will need to enable php in a couple of places before it will parse properly. there is a faq for that i think.
a static page with a form?
Posted on: 04/29/04 07:00pm
By: Nav
[QUOTE BY= machinari] doing the form up is just basic html and so you can view source of a form on the net to see an example or even a wysiwyg will do a form for you. then just paste the code into your static page. but to put the data into a db, you will prolly want to write a bit of php for that. and on a static page you will need to enable php in a couple of places before it will parse properly. there is a faq for that i think.[/QUOTE]
Ahhh so I can use just normal things, I thought that since it would be inside of geeklog there would be something special based on geeklog. Thanks mach.
Nav
a static page with a form?
Posted on: 04/29/04 07:11pm
By: Nav
what's getting me about these php forms in static pages is this, the form action=part, for a static page how could I make the form link back to itself, $PHP_SELF was what I assumed and that does not work.
a static page with a form?
Posted on: 04/29/04 08:55pm
By: machinari
I thought that since it would be inside of geeklog there would be something special based on geeklog
that depends on what exactly you are entering into the form and where you want it to go or to accomplish later... if it is, for example, additional user info or something like that, then you will have to involve gl code for things like UID and access info, etc.
for a static page how could I make the form link back to itself, $PHP_SELF was what I assumed and that does not work
php_self gives you a path relative to the doc root so try $_SERVER['PHP_SELF']