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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:33:55+00:00 2026-05-24T09:33:55+00:00

<?php $host=localhost; // Host name $username=root; // Mysql username $password=; // Mysql password $db_name=ureviewdu;

  • 0
 <?php
$host="localhost"; // Host name 
$username="root"; // Mysql username 
$password=""; // Mysql password 
$db_name="ureviewdu"; // Database name 
$tbl_name="Student"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

/* Obliterate bad input */
$secUser = mysql_real_escape_string($_POST['reguser']);
$badpasses = $_POST['regpass'];
$salt = '~Z`!@#$%I^&*()_-+Q=}]{[\|"><';
$secPass = md5($badpasses.$salt);

$sql = "INSERT INTO Student (uname, pass, fname, lname, email, currGrade)                VALUES('$secUser','$secPass','$_POST[regfirst]','$_POST[reglast]','$_POST[regemail]','$_POST[regclassrank]')";

$result = mysql_query($sql);
if ($result) {
    echo "Thanks for signing up!";
} else {
    echo "Failed.";
}


?>

HTML

<form action="inc/register/register.php" method="post" id="userRegistration">
        <div class="cen"><h5>User Credentials</h5></div>
        <div class="field required">
        Username: <input type="text" name="reguser" tabindex="1" /><br />
        </div>
        <div class="field required">
        Password: <input type="password" name="regpass" tabindex="2" /><br />
        </div>

        <div class="cen"><h5>User Details</h5></div>
        <div class="field required">
        First Name:<input type="text" name="regfirst"  tabindex="3" /><br />
        </div>
        <div class="field required">
        Last Name:<input type="text" name="reglast"  tabindex="4" /><br />
        </div>
        <div class="field required">
        Email:<input type="text" name="regemail" tabindex="5" /><br />
        </div>
        <div class="field required">
        Current Class:<select name="regclassrank"  tabindex="6">
        <option disabled="disabled">Select Class</option>
            <option value="1">Freshman</option>
            <option value="2">Sophomore</option>
            <option value="3">Pre-Junior</option>
            <option value="4">Junior</option>
            <option value="5">Senior</option>
        <option></option>
        </select>
        </div>
        <br />
        <div class="cen"><input type="submit" name="submitUser" /></div>
</form>

Does anyone see anything wrong with this? It submits fine, but then nothing is INSERTED into the database….

  • 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-24T09:33:56+00:00Added an answer on May 24, 2026 at 9:33 am

    You must execute the query with mysql_query.

    $sql = "INSERT INTO Student (uname, pass, fname, lname, email, currGrade)                VALUES('$secUser','$secPass','$_POST[regfirst]','$_POST[reglast]','$_POST[regemail]','$_POST[regclassrank]')";
    
    $result = mysql_query($sql);
    if ($result) {
        echo "Thanks for signing up!";
    } else {
        echo "There was an error processing your request. Please try again.";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<?php ob_start(); $host=localhost; // Host name $username=root; // Mysql username $password=; // Mysql password
Here is my code - <?php $host = localhost; // Host name $username =
I have my config.inc.php file, and have set my host name to localhost. Unfortunately,
I tried this so far: <?php $error = ; $conn = pg_connect(host=localhost dbname=brittains_db user=brittains
I am using MySQL and PHP 5.3 and tried this code. $dbhost = 'localhost';
Here is my php page which is called on button click. <?php $host=localhost; //
The goal: Connect to database using php to extract results Loop through results Store
is it necessary to use php to connect to the MySQL i am working
I'm trying to host a PHP web site that was given to me. I
PHP's parse_url() has a host field, which includes the full host. I'm looking for

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.