Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8907973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:03:27+00:00 2026-06-15T03:03:27+00:00

I am working on a php project where I have a user and has

  • 0

I am working on a php project where I have a user and has to undertake a risk assessment – they have to give the hazard type and give it a value of severity and likelihood for all hazards. I want to then record this in the database as separate rows.

The columns in database table looks like
hazard_id, hazard_type, severity, likelihood

The form fields would look like:
hazard type (text field), severity (drop-down) and likelihood (drop-down)

So I would have say 13 repeated lines of the above down the page – all with the same name?
or would you have hazard_type1, hazard_type2 etc

Then I want to post the values to the database so that each hazard shows as different row in the database.

If anyone can help that would be great.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:03:29+00:00Added an answer on June 15, 2026 at 3:03 am

    You can use arrays you just have to name your input fields properly

    name="hazard_type[1]"
    

    will be visible as

    $_POST['hazard_type'][1]
    

    In your case I would use

    name="data[1][hazard_type]"
    name="data[1][severity]"
    name="data[1][likelihood]"
    name="data[2][hazard_type]"
    name="data[2][severity]"
    name="data[2][likelihood]"
    etc
    

    then in PHP you can use

    $data = $_POST['data'];
    foreach ($data as $element) {
      $hazard_type = $element['hazard_type'];
      $severity = $element['severity'];
      $likelihood = $element['likelihood'];
      /* Here save each element into db */ 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, I'm working on a php college project, and I have to let students
My team working on a php/MySQL website for a school project. I have a
I'm working on a PHP project with several developers, each who has their own
I am currently working on a php/html/javascript project. I have a form where when
So I'm working on a PHP project that needs to allow the user to
I am currently working on a php project with the user of ajax. I
I am working on a project. This project have a user interface that we
I'm working on a CakePHP project and I have User, Post and Location models
I am currently working on a PHP Project where i need to integrate user
I'm working on a php project based on Joomla! and i'm using Aptana. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.