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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:28:35+00:00 2026-06-08T23:28:35+00:00

I am creating a phonebook program, where I can register and create my own

  • 0

I am creating a phonebook program, where I can register and create my own contact list. After login, the page will be directed to the tabmain page where I can view, add, edit or delete contact, in a multitab form.

Here’s the problem: Whenever I click the save button (the button in function displayNew), it should be getting the first name and surname then, look for the database if there is a match. If not, then add it should them. Now, what happens is, after I click the save button, nothing is passed to the variable.

Here is my code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<title>Tab-View Sample</title>

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords"    content="" />

<link rel="stylesheet" type="text/css" href="css_collect/distribution/tab-view.css" />

</head>
<body>

<?php $id = isset($_GET['id']) ? $_GET['id'] : 1; ?>
<?php
    include 'conSql.php';
    session_start();
    $mySession = $_SESSION['user'];

    //displays firsname and lastname of the user
    $getNames = getNames($mySession);
    $gET = explode("^", $getNames);

    echo "Hi, "."<b>". $gET[0] ." ". $gET[1] ."</b>"."!";
    echo "</br>";
    echo "</br>";


?>

    <div class="TabView" id="TabView">


    <!-- ***** Tabs ************************************************************ -->

    <div class="Tabs" style="width: 452px;">
      <a <?=($id == 1) ? 'class="Current"' : 'href="sample.php?id=1"';?>>Contact List</a> 
      <a <?=($id == 2) ? 'class="Current"' : 'href="sample.php?id=2"';?>>Add contact</a>
      <a <?=($id == 3) ? 'class="Current"' : 'href="sample.php?id=3"';?>>Edit / Delete</a>
    </div>


    <!-- ***** Pages *********************************************************** -->

    <div class="Pages" style="width: 450px; height: 300px;">

      <div class="Page" style="display: <?=($id == 1) ? 'block' : 'none';?>"><div class="Pad"></div>

            list of query

      </div>
      <div class="Page" style="display: <?=($id == 2) ? 'block' : 'none';?>"><div class="Pad"></div>
            <Form Name ='' Method ='GET' action = 'tabmenu.php'>
            <?php 
                displayNew(); 
                if(isset($_GET['btnAdd'])){
                    $fname = $_GET['txtFname'];
                    $lname = $_GET['txtLname'];

                    // $s = "SELECT * ";
                    // $s .="FROM tbl_contactlist ";
                    // $s .="WHERE fname = '". $_GET['txtFname'] ."' and lname = '". $_GET['txtLname'] ."'";
                    echo $s;
                }

            ?>

      </div>
      <div class="Page" style="display: <?=($id == 3) ? 'block' : 'none';?>"><div class="Pad"></div>
            <?php 
                displayEdit(); 
            ?>  
      </div>
    </div>

    </div>

    <script type="text/javascript" src="css_collect/distribution/tab-view.js"></script>
    <script type="text/javascript">
    tabview_initialize('TabView');
    </script>



    <?php


    function getNames($mySession){
    //get the real name of the user (firstname and lastname)
        $s = "SELECT * ";
        $s .="FROM tbl_users ";
        $s .="WHERE username = '". $mySession ."' ";        
        $rc = mysql_query($s);

        $row = mysql_fetch_assoc($rc) or die();
        $details =  $row["fname"]."^".$row["lname"];
        return $details;
    }
    function displayNew(){
        echo "<table border = '0'>";
        echo "<tr>";
        echo "<td colspan='2'><b>New Contact</b></td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td colspan='2'>Please fill up the fields.</td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td>First Name: </td>";
        echo "<td><input type='text' name='txtFname' id='txtFname'></td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td>Last Name: </td>";
        echo "<td><input type='text' name='txtLname' id='txtLname'></td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td>Nick Name: </td>";
        echo "<td><input type='text' name='txtNicname' id='txtNicname'></td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td>Contact Number: </td>";
        echo "<td><input type='text' name='txtContactNum' id='txtContactNum'></td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td></td>";
        echo "<td><input type='submit' name='btnAdd' id='btnAdd' value='SAVE'></td>";
        echo "</tr>";
        echo "</table>";
    }
    function displayEdit(){
        echo "<table border = '0'>";
        echo "<tr>";
        echo "<td colspan='2'><b>Edit / Delete Page</b></td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td colspan='2'>You can edit or delete:</td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td>First Name: </td>";
        echo "<td><input type='text' name='txtFname' id='txtFname'></td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td>Last Name: </td>";
        echo "<td><input type='text' name='txtLname' id='txtLname'></td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td>Nick Name: </td>";
        echo "<td><input type='text' name='txtNicname' id='txtNicname'></td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td>Contact Number: </td>";
        echo "<td><input type='text' name='txtContactNum' id='txtContactNum'></td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td></td>";
        echo "<td><input type='submit' name='btnEdit' id='btnEdit' value='EDIT'>";
        echo "<input type='submit' name='btnDelete' id='btnDelete' value='DELETE'></td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td></td>";
        echo "<td><input type='submit' name='btnCancel' id='btnCancel' value='Cancel'></td>";
        echo "</tr>";
        echo "</table>";
    }
    function testMe(){
                echo "<script type='text/javascript'>\n";
                echo "alert('T E S T');\n";
                echo "</script>";
    }


    ?>
</body>
</html>
  • 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-08T23:28:36+00:00Added an answer on June 8, 2026 at 11:28 pm

    It looks like you don’t ever close the form tag in the HTML, that might cause the page to not do anything when you click submit

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Creating a login page in xcode 4.2 I have the users fill out information
Creating a web interface so our helpdesk can create users and setup some of
(creating a separate question after comments on this: Javascript redeclared global variable overrides old
Creating a server-side socket will fail if I'm trying to use the same port
Creating a table without tbody using javascript createElement/appendChild will not add tbody in Firebug
Creating a site in with FrogCMS and using alot of jquery to create an
creating 20 viewcontrollers and calling them one after the other from the mainviewcontroller as
Creating a C# install package and I'd like on completed install for the Program
Creating simple php login scripts is easy, with simple one table mysql integration. I
Creating a popup window from main page with window.open, the child/popup page uses 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.