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 3610348
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:44:27+00:00 2026-05-18T21:44:27+00:00

i`m just starting in php, and I was wondering how to make a sign

  • 0

i`m just starting in php, and I was wondering how to make a sign up form. I’m not really sure on how to add the values to the database. I’m using phpMyAdmin for the databases.

I have the inputs here:

<div id="registerSpace">
 <form id="formulaireInscription2" name="formSignup" method="post" action="signUp.php">
  <div class="registerUsername"><input type="text" placeholder="Username" name="txtUserName" /><span class="textInputs"></span></div>
  <div class="registerNom"><input type="text" placeholder="First name" name="txtNom" /><span class="textInputs">First name</span></div>
  <div class="registerPrenom"><input type="text" placeholder="Last name" name="txtPrenom" /><span class="textInputs">Family name</span></div>
  <div class="registerPassword"><input type="password" placeholder="Password" name="txtPassword" /><span class="textInputs">Password</span></div>
  <div class="dropLogonContentOptions"><input type="submit" value="Sign Up" name="send" />
 </form>
</div>

I put all my code in signUp.php.
In phpMyAdmin, my database’s called jleggett_colourful, and my table (where the user, password, first name blabla) is: t_usagers.
In there, I have u_id(auto increment, numbers only), u_nom(last name), u_prenom(first name), u_courriel(mail, also username!) and u_password.

What would be the best way to add it to the database? I have this code here:

<?php 
 session_start();

 include 'inc/define.inc.php';
 include 'inc/fct.inc.php';



 if (isset($_POST["txtUserName"]) && isset($_POST["txtNom"]) && isset($_POST["txtPrenom"]) && isset($_POST["txtPassword"]))
 {
  // Ouvre une connexion au serveur MySQL
  $connection = mysql_connect(NOM_SERVEUR, USER_NOM, USER_PASSWORD) or die("Impossible de se connecter : " . mysql_error());
  if (!$connection) {
    fin_perso('Problème de connexion au serveur : '. ' ---' . NOM_SERVEUR. '- - -' . USER_NOM. '- - -' . USER_PASSWORD. '- - - '  . mysql_error(), 'erreur_bd_');
  }

  // S�lectionne une base de données MySQL
  if (!mysql_select_db(NOM_BD))
  {
     fin_perso('Problème de connexion à la base de données : ' . mysql_error(), 'erreur_bd');
  }

  $sql = "INSERT INTO t_usager (u_nom, u_prenom, u_password) VALUES ('fdfs', 'qwerty', '456789')";

 else
  echo "Please, enter all informations"
?>

I’m a bit lost here, but it should look like this! The code to connect to the database is correct, I just don’t know how to add it with the values from my form. Thx! (I have entered default values, just for testing in $sql).

  • 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-05-18T21:44:28+00:00Added an answer on May 18, 2026 at 9:44 pm

    You will change the following:

    $sql = "INSERT INTO t_usager (u_nom, u_prenom, u_password) VALUES ('fdfs', 'qwerty', '456789')";
    

    to use the values in the $_POST array (i.e. $_POST[‘txtUsername’]). And then after you build the string for your query, you will need to call mysql_query ( $sql ); in order to actually run the query.

    I believe that you are also missing a pair of {} within your code because the line with $sql on it is currently not valid (with the else right after since there is no nearby if it can relate to).

    Code Example:

    $nom = mysql_real_escape_string ( $_POST [ 'txtNom' ] );
    $preNom = mysql_real_escape_string ( $_POST [ 'txtPrenom' ] );
    $pass = mysql_real_escape_string ( $_POST [ 'txtPassword' ] );
    $sql = "INSERT INTO t_usager (u_nom, u_prenom, u_password) VALUES ('$nom', '$preNom', '$pass')";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im not a pro at PHP, just starting actually and was wondering if you
I am just starting out with PHP, and I am wondering if there is
I'm just starting to learn more advanced SQL along with PHP and I'm really
I am just starting with elasticsearch. I want to query using cURL in php.
I'm just starting to learn PHP and am using the W3 Schools tut. In
I'm just starting PHP programming as you can tell. I want the results of
First, thank you for reading this. I am just starting php and I am
I am just starting to learn php, how would I initiate a echo statement
I'm just starting with Object Oriented PHP and I have the following issue: I
I am just starting to learn a little about PHP; having trouble with the

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.