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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:30:14+00:00 2026-06-03T20:30:14+00:00

I am trying to create a javascript that split the tags (that the user

  • 0

I am trying to create a javascript that split the tags (that the user gives, separated them with comma (,)) and pass them in my database in different rows but with the same id.
i have this code:

<form name="formatform" method="post" onsubmit="return validate_format_form()" action="formatsubmit.php">
<p>
Συντομος Τιτλος:<input type="text" name="titlos" value="">
Συντομη περιγραφη:<input type="text" name="perigrafi" value="">
</p>
<p>
Τοποθεσια:<input type="text" id="loc" name="topothesia" value="">
Tags:<input type="text" name="tags" value="">
**Οι ετικέτες πρέπει να χωρίζονται με κόμμα
</p>
.
.
.
</form>

and in formatsubmit.php which is the one who pass them into database these code:

$query= " INSERT into photos(`title`,`description`,`location`,`privilages`,`ph_tags`) VALUES ('".$_POST['titlos']."','".$_POST['perigrafi']."','".$_POST['topothesia']."','".$_POST['radio_check']."','".$_POST['tags']."') ";
$result= mysql_query($query,$con);

If the user gives 3 tags(separated with comma) i want to split them and pass them to database in different rows.
How can i do that?

  • 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-03T20:30:15+00:00Added an answer on June 3, 2026 at 8:30 pm

    How about splitting the tag input into an array using comma as the delimiter and then iterating over the tags and creating one insert statement per tag? E.g.

    $tag_array = explode(",", $_POST['tags']);
    foreach ($tag_array as $tag) {
      $query= " INSERT into photos(`title`,`description`,`location`,`privilages`,`ph_tags`) VALUES ('".$_POST['titlos']."','".$_POST['perigrafi']."','".$_POST['topothesia']."','".$_POST['radio_check']."','".$tag."') ";
      $result= mysql_query($query,$con);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem trying to create a Javascript function that checks all the
I'm trying to create a custom javascript class that inherits from google.maps.Map (V3 API).
I am trying to create a simple Javascript text editor that only makes paragraph
I am currently trying to pass an array that I have created in Javascript
I'm trying to create javascript closure that will tell me if the function has
I am trying to create a Javascript function that will return all javascript files
I am trying to create a JavaScript regular expression that can find a keyword
I am trying to create a button in javascript that when clicked adds an
I'm trying to create a simple prototype in JavaScript that removes a character from
I'm basically trying to create a generic object in javascript that I can use

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.