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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:07:44+00:00 2026-05-31T01:07:44+00:00

This is the shortest of two forms that wont send data to the database,

  • 0

This is the shortest of two forms that wont send data to the database, but I have one that does work. When I press submit the form refreshes, clears the page and doesn’t send the data to my table. I’ve included my HTML incase that is a problem.

include 'dbc.php';

$err = array();

if(@$_POST['doPersonal'] == 'Personal') 
{

This code filters harmful script code and escapes data of all POST data
from the user submitted form.

foreach($_POST as $key => $value) {
    $data[$key] = filter($value);
}

Automatically collects the hostname or domain like example.com)

$host  = $_SERVER['HTTP_HOST'];
$host_upper = strtoupper($host);
$path   = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');

if(empty($err)) {

SQL Insert

$sql_insert = "INSERT into `personal`
    (`sex`,`aux_citizen`,`birth_place`,`birth_country`,`children`)
    VALUES
    ('$data[sex]','$data[aux_citizen]','$data[birth_place]','$data[birth_country]',
    '$data[children]')";

mysql_query($sql_insert,$link) or die("Insertion Failed:" . mysql_error());

header("Location: thankyou.php");  
exit();
} 
}       
?>

HTML code for the form:

<html>
<head>
    <title>title</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="JavaScript" type="text/javascript"
            src="file:///js/jquery.validate.js"></script>
    <tr>
    </tr>
    <script>
        $("#regForm").validate();
        })
        ;
    </script>
    <link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="5" class="main">
    <tr>
        <td colspan="3">&nbsp;</td>
    </tr>
    <tr>
        <td width="160" valign="top"><p>&nbsp;</p>

            <p>&nbsp; </p>

            <p>&nbsp;</p>

            <p>&nbsp;</p>

            <p>&nbsp;</p></td>
        <td width="732" valign="top"><p>
            <?php
            if (!empty($err)) {
                echo "<div class=\"msg\">";
                foreach ($err as $e) {
                    echo "* $e <br>";
                }
                echo "</div>";
            }
            ?>
            <br>

            <form action="personal.php" method="post" name="regForm" id="regForm">
                <table width="95%" border="0" cellpadding="3" cellspacing="3" class="forms">
                    <tr>
                        <td>Sex <font color="#CC0000">*</font></span></td>
                        <td><select name="sex" class="required" id="sex">
                            <option value="" selected></option>
                            <option value="M">Male</option>
                            <option value="F">Female</option>
                        </td>
                    </tr>
                    </select>

I wont put the rest of the HTML code as it will go on forever, but this is the submit function

<input name="doPersonal" type="submit" id="doPersonal" value="Submit">

Can anyone see the problem? It has worked once but now it won’t
Thanks in advance

  • 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-31T01:07:45+00:00Added an answer on May 31, 2026 at 1:07 am

    It looks like the name attribute and value attribute of your submit button are inconsistent with your check in the processor form:

    // Submit's value should be 'Personal'
    if(@$_POST['doPersonal'] == 'Personal') 
    
    
    // But your value on the button is 'Submit'
    <input name="doPersonal" type="submit" id="doPersonal" value="Submit">
    
    // You can change this to:
    if($_POST['doPersonal'] == 'Submit') 
    // But see the improved version below...
    

    Instead of using the @ to suppress errors, check for the presence of the array key before attempting to use it:

    if (!empty($_POST['doPersonal']) && $_POST['doPersonal'] == 'Submit') {
       // Handle your form
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written an A* that works nice. It gives me the shortest path
I have a one to many relationship between two tables. The many table contains
I have a movie database (postgreSQL). One of tables contains actors and movie titles.
I have to get the (shortest)/(an optimal) distance between two points in 2D. I
For a Data Structures project, I must find the shortest path between two words
What's the shortest way to do this in Python? string = xyz must return
what would be the shortest way to write this? if(strpos($haystack, $needle)!==false){ $len = strpos($haystack,
This is a bit of a long shot, but if anyone can figure it
This is kinda oddball, but I was poking around with the GNU assembler today
This might seem like a stupid question I admit. But I'm in a small

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.