Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2012, 12:14:06 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155504 Posts in 21710 Topics by 7736 Members
Latest Member: deenangle
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Workign with forms  (Read 1023 times)
abidan

Offline Offline

Posts: 102


« on: May 13, 2009, 12:10:04 AM »

Hi

Hoping someone can give me some clues on where to begin with this. I want to start learnign php using WebsiteBaker and create a very simple system to learn how to submit and retrieve simple data from the database.

In the first instance i was going to use the form (or form x) module to submit the data from a client but looking in the back end i cant figure how the heck this works. It appears when you create fields using the form module to create your form it creates fields seperately in the mod_form_fields table and when a user submits a form it storse the data in the submissions table........i dont get why all the defined fields are stored in one big field!!??

Basically i need to create a form with all seperate fields to capture data seperately and submit it to a table.
I then need to be able to simply retrieve that data and display it on a page.

Just this would do at this stage so am i best creating my own tables and not use the form module?

In the next stages i will need to be able to search the tables by date submitted I will also need to limit the access to the data by a login.

Can anyone give me some guidance on any modules i should be using and looking at or wehter i should just build everything form scratch within website baker?

Thanks in advance from a newbie learning php
Logged
Argos
Moderator
**
Offline Offline

Posts: 2158


WWW
« Reply #1 on: May 14, 2009, 10:08:12 AM »

I'm not quite sure what you mean, and I 'm no coder myself, but there are quite some modules that are based upon data input in forms, and output in different ways. Did you look around http://www.websitebakers.com?
Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2295



WWW
« Reply #2 on: May 14, 2009, 10:22:16 AM »

The form-x module is a very complex module. I would not use that one to start learning PHP.

Did you have a look at the "Hello World" module? For the backend it also uses a form to save data, and it will retrieve data out of the database.
Since everything is documented, it is a much better way to start.

Ruud
Logged

Professional WebsiteBaker Solutions
abidan

Offline Offline

Posts: 102


« Reply #3 on: May 14, 2009, 04:14:18 PM »

Hmmmmmmmmm yeah, i looked at hello world but using 2.7 and i am sure i read somewhere that it was disconinued in my vrsion?Huh?

Logged
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2295



WWW
« Reply #4 on: May 15, 2009, 09:48:55 AM »

There was a new idea to create a "learning" module, but I don't think that was fully done.
I am pretty sure the hello world will function in 2.7. If not, it might be a nice exercise to make it work again  cool

Ruud
Logged

Professional WebsiteBaker Solutions
abidan

Offline Offline

Posts: 102


« Reply #5 on: May 15, 2009, 10:03:28 AM »

Just to let you know it works fine in 2.7 thanks for the help Smiley
Logged
mr-fan

Offline Offline

Posts: 1556


WWW
« Reply #6 on: May 15, 2009, 11:49:59 AM »

http://www.websitebaker2.org/forum/index.php/topic,13133.0.html

maybe - better for understanding WB modules

regards martin
Logged

 
abidan

Offline Offline

Posts: 102


« Reply #7 on: May 15, 2009, 01:19:13 PM »

Ok can anyone help me a bit?

I got part of this working i can create a form that nicely sits in a page on my website. I did this by entering the following into a view.php for a module i have created which is installed in a folder called ordering in my modules folder:
require('../config.php');

// prevent this file from being accessed directly
if (!defined('WB_PATH')) die(header('Location: ../../index.php'));
// output a message when the module is opened in the WB backend

?>
<h1>Order Form</h1>
<form action="<?php echo htmlspecialchars(strip_tags($_SERVER['PHP_SELF'])); ?>" method="post"><input type="hidden" name="agent" value="<?php echo $_SESSION['USERNAME'] ?>"/>
Type: <input type="text" name="type" /><br> House Number: <input type="text" name="housenum" /><br>
<input type="submit" />
<input type="hidden" name="submitted" id="submitted" value="0" />
</form>

I would rather sumbit the form to another page than to itself to be honest as that page will be the admin page for a user logged in and will have other options to view history etc once that have finiished submitting.

My question is i can get it to submitt to anotehr page easily say i call it insert.php BUT I dont know how to make that page include the tempalte layout rather than it just being a blank page with a message saying submitted?
How do i include the atcual template header and fotter etc and then display my page saying successful???

Any help much appreciated from someone learning php and website baker Smiley
Logged
abidan

Offline Offline

Posts: 102


« Reply #8 on: May 15, 2009, 11:45:58 PM »

can anyone give me any clues on where i am going wrong with this??? please Sad
Logged
applepie

Offline Offline

Posts: 342


« Reply #9 on: May 24, 2009, 09:16:12 AM »

can anyone give me any clues on where i am going wrong with this??? please Sad
I am not sure what you are asking here. Are you rewriting your own submit form page apart from the mod that comes with WB? Id you use the WB mod, you only need to specify that return page from the settings. And you can direct to any page you like with whatever texts you want to include on the page.
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!