Welcome to Geeklog, Anonymous Friday, March 29 2024 @ 10:52 am EDT

Geeklog Forums

a static page with a form?


Status: offline

Nav

Forum User
Newbie
Registered: 04/08/04
Posts: 7
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
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
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

Status: offline

Nav

Forum User
Newbie
Registered: 04/08/04
Posts: 7
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.


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
 Quote

Status: offline

Nav

Forum User
Newbie
Registered: 04/08/04
Posts: 7
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.
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
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']
 Quote

All times are EDT. The time is now 10:52 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content