Calling an HTML page by passing information to a Mysql database via PHP

Asked

Viewed 281 times

0

Hello!
I took on a project here at the company, where it was proposed to make a pre-questionnaire for the user before he accessed a questionnaire. Up to a certain point the user navigates between the possibilities and at a point he has to answer some things, which is where I’m stuck. I am making the site in HTML and I have not needed to use PHP until now. At this time I will need to use. We have the database installed and configured, I just need to know how to use it now! The question is this: How can I call the next page, passing to the bank the value that the user selected and loading the page that refers to the user’s choice? Exemplifying:

You went to your immediate manager?
- Yes -> Pass to the bank the value 'yes' -> Load the page that corresponds to the affirmative answer.

After that, on a next screen, I will have to collect what the user also type, so I need to know how to step what he typed after clicking "Proceed". So, friends! How can I do this? I don’t deal with PHP for a long time and I accepted this task as a challenge. I was able to implement some really cool stuff and this, which is the most important part, I’m stuck... Maybe exhausted from having to remember so much so far!

So that’s the question! What is the best method to validate what the user chose/typed, send to the database and then load the page referring to the user’s choice? Ah! The detail is that the information will be entered gradually... Type, the user answers the first question (Boolean type), it is stored, then the bank will "wait" the next input, still in the same ID. Then when the user type and click 'next' the typed text will be sent (Varchar type) and wait for the next input. At the end, the user will be redirected to the Questionnaire, which is already ready. In this questionnaire he will make some more inputs, adding to the Pre-questionnaire ID. If this is too difficult to do, I can concatenate that data when I report - which is what you need - at the end of the questionnaire. What I developed in HTML was basically... Nothing. I don’t know what I’m going to use! The part where the user chooses between Yes and No is the one that follows:

    <div id="content">      
    <p><br>Você procurou seu Gestor Imediato para resolver a situação que deseja relatar na Ouvidoria Interna?</p> 
    <nav>
    <ul class="group" id="menu">
        <form action="" method="get" id="validar">
        <li>
        <input type="hidden" name="submit_sim" />
        <a href="#" onClick="document.getElementById('validar').submit();">Sim</a></li>
        <li>
        <input type="hidden" name="submit_nao" />
        <a href="#" onClick="document.getElementById('validar').submit();">Não</a></li>
    </ul>
    </nav>
</div>

I will validate the connection in.php and then insert the data into the table via &_GET. It’s the best method, right!? :)

So this is it! This is my first question here, so excuse me if I have inflicted some rule and correct me if I have missed some information.
Remembering that I don’t want anything chewed, I just want a direction of what I should use and how, if possible! Thank you all!

  • 1

    Dude since it’s your first time here you miss a few minutes here http://answall.com/tour gives an edited and puts some code you are testing...

  • The problem is that I have virtually nothing developed! Just the "face" of the page. Does the community help by giving 'direction', or just helping with bugs/bugs? I really don’t know, rs. I had done the tour but thank you so much anyway!

  • It would be nice to divide the problem into smaller parts, and ask step by step as you resolve your doubts. In addition to a read on the tour, as @Magichat mentioned, it’s nice to meet the site scope, a read on [Ask] and [help] to understand how to make the most of it. Very broad things, or depending only on opinion, do not work very well in the Questions & Answers format.

  • And remember to do a background check on similar topics on the site. Maybe part of what you want to know already has answers, and it’s a great way to see the kind of question that works well here, and attracts better answers, and the kind of question that doesn’t work as much. That said, welcome and I hope the links mentioned can help you make a good use of the site.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.