-2

I am designing a site for ship maintenance. For now I have 3 files: .info, .install, and .module.

In .install the table schema is automatically installed into the database. It has information like ID, shipname, officer name etc.

Now in .module I have created a form in which you input shipname, officer name, subject, etc.

My problem is this: When I input my data in the form, the data is stored into the table and I display it into to a table (my_module_submissions).

Besides that I want to have a page created every time a user inputs the form and that the page title is taken from the subject.

It's like when you create new content like a story, you input title, content, and some other data. Then when you click submit you are redirected to the newly created page.

Currently I have the form which data is stored into a table, and I get that information and show it into a table (using db_select). How can i create the above?

Filling the information

enter image description here

now when i input the data i get my inputed data showned in this link : content/repair_of_main_fuse_box_wiring

So i have a PAGE where i can go to enter image description here


Now my situation right now is this :

I have created the same thing in php as the first picture . But i can only show my data like this :

enter image description here

Now i have the data but i have no link for every specific row in a table. I dont have a page a can go to for that data.

  • OK, picture you created a virtual phonebook using views and other modules that let you verify phone number, email etc. Now you create a form that has lets say : Name, Lastname, phone number,e-mail, street adress ect. basic stuff. Now when you would click save or submit a new page is created (www.mysite.com/mike_something) where you can view the sotred data. NOW, lets say you create your own module for that. You write the code and in my case when i click save it goes to the table (created in .install) and i call it back in a table. – Chevap Apr 15 '13 at 8:33
  • See the difference when you use the modules you get a PAGE with the data and a link to that data. In my case all of my data is stored in a table and i can only show it in a table. What i would like to learn is how to when i click submit that i get a PAGE and a link to that data. And yes db_select is used as a dynamic querie. – Chevap Apr 15 '13 at 8:44
  • yeah it is because you dont have the whole pictures and houndred of lines of code that do specific thing. The pictures are just an very old project of mine. I cannot use forms because i have to then use a lot of modules that do the stuff needs to be done. A good programer would never use modules and so on for something more complex because you relay on someones else module to work for a long time. So if you can help ok if not dont judge me because you don't know or wont tell or give a link how to do what i need to do. – Chevap Apr 15 '13 at 10:12
2

Is it a drupal 7?

If so, its easily to create new entity type. More information here.

Why you don't like to use nodes to store your data? Just create new node type with required fields and add permission to create nodes of this type to all users.

In both cases you can use views to represent data into table format.

  • Using views would be ok, but other addons that are not in the core are not for me. One changes and the walls come crushing down because i have to use 7-8 modules to do what needs to be done for the site. Yes it is Drupal 7. – Chevap Apr 15 '13 at 8:30
  • There's nothing wrong with using 7-8 modules as long as it gets the job done. However re-inventing the wheel, I'm against that kind of approach. – Beebee Apr 15 '13 at 10:45
  • Yeah that why we had the dark ages. Why not reinvent the wheel ? The wheel is reinvented whit Tweel, and the wheel was reinvented from stone to wood to rubber. Any how lets say you have 7-8 modules and you updeate them (funky cool new features) and lets say you have a site of 10 000 people. Boom drupal or other modules dont support some other features, or something else is wrong and your site starts doing funky things what then? You blame the module? I am fine with sites that are simple and dont need alot of modules, but for me it's a no go. So if someone can help OK in not OK. – Chevap Apr 15 '13 at 11:07
  • That's what backups and version controls are for so you always can revert back. If you're updating with no return points then you're doing it wrong. Anyway, good luck. – Beebee Apr 15 '13 at 13:34
  • +1 for using what is available where possible. Most of the time you will be better off in the long run. I would say use a node type, then give users access to create, then if you need to store extra data in another table use node hooks - api.drupal.org/api/drupal/7/search/hook_node_ - like hook_node_insert() and hook_node_update(), etc. – rooby Apr 21 '13 at 5:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.