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

  • Home
  • SEARCH
  • 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 8831871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:24:25+00:00 2026-06-14T08:24:25+00:00

so I have: $input=array($fname,$lname); I then use: $valueString = join(,,$values); echo $valueString; if I

  • 0

so I have:

$input=array($fname,$lname);

I then use:

$valueString = join(",",$values);
    echo $valueString;

if I had input $fname = a and $lname = f
I then receive:

a,fa,f

Not sure why I get the ‘fa’ value and how to edit my code so I get just a,f

apologies for the poor question, though it would be simpler

this is the function;

 function insert($coloumn, $values, $table)
{

    $valueString = join(",",$values);
    echo $valueString;
    $insert = "INSERT INTO $table ($coloumn)
        VALUES ($valueString)";
    //$query = $this->dbLocalhost->query($insert)
    //or die("could not insert:".mysql_error());

    if($this->dbLocalhost->query($insert))
    {
    header('Location: blah.php');
    }

}

and the this the page for the inputs:

   <?php
session_start();
require_once("database.php");
$db = new Database();
$table = "tables";
$coloumn = "firstname, lastname";
if(isset($_POST['Add']))
{

    $fname = $_POST['firstname'];
    $lname = $_POST['lastname'];



    $input=array($fname,$lname);

    $db->emptyCheck($coloumn, $input, $table);



}
?>
<html>
    <head>
        <title>Add new Record</title>
    </head>
    <body>
        <br><br><br><br><br>
        <div id ="formAlign" align="center">
        <form action="" method ="post">
            <label for="firstname"> First Name:</label>
            <input type ="text" name="firstname">
            <label for="lastname"> Last Name:</label>
            <input type="text" name="lastname">

            <input type="submit" name="Add">
        </form>
        </div>
    </body>
</html>

To clarify

$db->emptyCheck($coloumn, $input, $table);

leads to:

$this->insert($coloumn, $values, $table);

being called.

  • 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-14T08:24:26+00:00Added an answer on June 14, 2026 at 8:24 am

    implode() works fine. You are outputting the result of implode() twice.

    'a,f' . 'a,f' = 'a,fa,f'
    

    Note: I encourage using the root function and not the alias. (e.g. implode() vs. join())

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

Sidebar

Related Questions

I have this form with a date input. echo $this->Form->create('Nodata'); echo $this->Form->input('date1', array('type' =>
I have following 2 dimensional array input: var arr = [ ['A', ['Sun','Moon']], ['B',
I have an array of input controls garnered like so: var hiddenInputs = $(input[id^='Unanswered'])
I have an array of input strings that contains either email addresses or account
I have a an array: $result = array('statusAlert' => 'Your input was validated' 'input'
Hi I have an array of checkboxes e.g. <input type=checkbox name=checks[] value=1 /> <input
Here's an example of what I mean: I have an array: array('type'=>'text', 'class'=>'input', 'name'=>'username',
I have two tables: student Columns first_name last_name teacher_accounts Columns fname lname I have
I have input array as: Input Array: array 324545433 => array 0 => array
I have as input an array of 3D points. And I need to draw

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.