How can I insert values textarea one both in the database?

I have a simple form:

Select list - populated by a recordset that gets the list of technicians.   In this format: Label - > name of Tech value - > ID Tech

TextArea - paste zip codes in this tech services.    In this format: 12345,12346,12347, etc...

When I want to send the form, I want to take all postal codes and insert them into the database as a single record each with the id of the tech of the selection list.

The code I have is:

$zipcodes = explode(",", $_POST['textarea']);
$countZips = (count($zipcodes));
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
foreach($zipcodes as $key=>$value)
{


while ($countZips >= 1) {
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

  $insertSQL = sprintf("INSERT INTO zip_zip (zip_code, tech_id) VALUES (%s, %s)",
                       GetSQLValueString($value, "int"),
                       GetSQLValueString($_POST['select'], "int"));


  mysql_select_db($database_localhost, $localhost);
  $Result1 = mysql_query($insertSQL, $localhost) or die(mysql_error());
          $countZips--;
}
//Done value exists
//Now moving to next page when done
} 
          $insertGoTo = "index.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
//END

The question is - Let's say I have paste 105 postal codes into the text box.   It inserts the FIRST postal code 105 times in the database instead of insert postal code 105 individually.

No idea what I'm doing wrong here?

Thank you!

You loop does. Delete this While loop, it is not necessary, and you don't need to follow the count. The foreach loop does all the work.

Tags: Dreamweaver

Similar Questions

  • How can I pass values from one node to the other

    Give a standard and efficient way to pass values of the child to the parent

    Hai Prathap

    You can use the custom event to pass values from the children to the parent

  • How can I insert values with a single quote (')

    How can I insert a values as ABC?

    Published by: LuKKa on October 6, 2010 12:48

    LuKKa says:
    I want to insert like this: -.
    INSERT INTO myTab values ("it is to belong to ABC '");

    So how do I do?

    In an old style, you can do

    insert into mytab valeus('This is belong''s to ABC''s');
    
  • How can I move photos from one folder to the display of my gadgets?

    How can I move a photo from a folder at my gadgets screen or my list of gadgets so that I can spend it?

    Hello

    What operating system is installed on the computer?

    I suggest you try the steps from the following link:

    Gadgets Google Desktop (overview)
    http://Windows.Microsoft.com/is-is/Windows7/desktop-gadgets-overview

    See also: Google Desktop gadgets: frequently asked questions
    http://Windows.Microsoft.com/en-us/Windows7/desktop-gadgets-frequently-asked-questions

  • How can I open picture with one. MIX the extention of file

    A few photos on my computer stops have one. Extension of file MIX and w' opened. What causes this

    A few photos on my computer stops have one. Extension of file MIX and w' opened. What causes this

    ========================================
    Some. MIXTURE of files created with Microsoft
    PhotoDraw but more that likely... they were created
    with Microsoft Picture It!.

    (to open the PhotoDraw files... you have PhotoDraw)

    The picture it!. requires format Mix (extension)
    Ms Picture It! or MS Digital Image.

    If you need an application to open files with... you
    could use the trial version of 60 days of digital
    2006 image.

    Even if you have the .mix files... it might be
    a good idea to save them in a more universal
    .jpg, .png, or .tif format. You can make a
    lot in Digital Image if you are going to...
    ...... Editing / Edit in Mini Lab to batch / save under...

    The number of files that you can convert simultaneously
    depends on your system resources but I
    would try 50 and see what happens.

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    Microsoft Digital Image
    Starter Edition 2006
    http://www.Microsoft.com/downloads/en/details.aspx?FamilyId=7C3B3DED-A15F-48C5-B724-7796FE8C151E&displaylang=en
    (this product line has been
    abandoned, but you can still
    Download the Starter Version
    and run it to 60 days)

    Another option...

    How to see and/or convert. Picture It!. mix files.

    If you have any version of MS Picture It! / MS
    Digital image... give it a try.

    If they are single image files that have been created
    with MS Picture It!... the following information can be
    your solution:

    The evaluation version of PolyView may allow
    lot to reformat your .mix files.

    You can download an evaluation copy to the
    following link:

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    PolyView
    www.Polybytes.com
    (Go to...) Downloads / PolyView 4.42 Setup
    Program)

    When you open PolyView... go to...
    File / Format Conversions...

    Navigate to the folder that your .mix files
    recorded in and open the drop window and
    Choose "All Files".

    On the left, click on the button "add all".

    On the left, click on the button "continue"...

    Choose your JPEG Format 'Destination '.

    Choose your JPEG quality... 100

    Choose a 'Destination folder '...

    Left click on the button 'start '.

    Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • How can I copy light from one window to the other in a photo?

    I'm looking at printing an image I shot the winter as our map of Christmas this year. There are three windows in a medieval building, each consisting of several components in the lead and the one on the far left is turned on. My partner would in the middle one turn on as well. Is this doable without committing a lot of time to the project or do I need to book the snow again and organise a reshoot?tempest anderson lo res_edited-1.jpg

    Here I used the Polygonal Lasso to select half top of the Panel to the right of the lighted window and copy and paste this into a new layer.

    Then reproduces this layer, aligned vertically on two layers, linked to them and moved them on top of the dark window.

    You can then merge together and duplicate the fusion 3 times the value to fill the other 3 panels.

    Note: to select the start window you can also use the selection brush: use a hard square brush, the size of the window, click on the upper part of the window and holding shift button, drag the mouse down to select the rest (shift requires the mouse to move it to the bottom).

  • How can I move pages from one document to the other without merger of paragraph styles?

    I want to create a singular indesign file of 2 separate documents, which allows me to make an interactive PDF of it.

    However, when you move pages from one to the other, it seems that when each document has a paragraph style with the same name, they merge. The problem is that text is then adjusted if the styles do not match completely.

    Is there a way to merge the documents without any formatting changes?

    Create a Style group in each document and move all styles in this file. Give each document a different name. Do it with all kinds of styles: paragraph, character, objects, tables and Cell Styles. Then you can sort them later in the merged document what you do with these styles.

  • How can I copy information from one image to the other GPS?

    I bought a Canon S100 specifically for its GPs and film.  These last vacation, I used the S100 and a Nikon D300.  In cases where the images were taken with both cameras roughly the same place, I would like to copy GPS information to CR2 S100 files to the D300 NEF files.  Does anyone know how to do this or if there is no plugins that will do it?

    And the answer is!   LIGHTROOM Beta 4!  It does everything I need.  Just announced today!

  • How can I copy files from one disk to the other?

    I want to copy all my mp3 files from my ITunes music folder on an external hard drive.  I'm not interested in records, only the mp3 of themselves.  I got here in 'terminal' that I can execute a command?  Please notify.  Thank you.

    Just use the search function in the Finder.

    Select the folder enclosing and type MP3 in the search.

    If you have not changed the search preferences, you will need to click on the name of the folder next to "this Mac.

    It should list all the MP3 files.  Select all and drag to the external hard drive.

  • HP Pavilion 510-p010: How can I insert my xD Picture Card into the slot

    I just bought this HP Pavilion 510-P010.  I was told the slot would fit in my sD card, I specifically asked about this until I bought it.  They said he would do.  I can't that it fits in the normal way, does it go side?  And if so, what sense does face.  I'm afraid to stay in it and something will happen if I do not do so in law.
    The card is a card, xD-Picture Card 2 GB M.

    You said it was an xD card, which is specific to Olympus and Fuji XD Picture Card of the camera.

    I don't know of all model Compaq or HP who could accept these cards... enlighten us?

  • In the Api Soap Echosign, how can I send more than one file for the signature...

    Some examples of code for sending single document...

    $client = new SoapClient(EchoSign\API::getWSDL());)

    $api = new EchoSign\API ($client, "YOUR API KEY");

    $file = EchoSign\Info\FileInfo::createFromFile('demo.pdf');

    $document = new EchoSign\Info\DocumentCreationInfo ("Test sendDocument", $file ");

    $recipients = new EchoSign\Info\RecipientInfo;

    $recipients-> addRecipient ($recipient_email);

    $document-> setRecipients ($recipients);

    $result = $api-> sendDocument ($document);

    Hello

    You will find the documentation of the DocumentCreationInfo object in the EchoSign API SOAP at https://secure.echosign.com/public/docs/EchoSignDocumentService22#DocumentCreationInfo

    You will see that you can provide an array of files in the field of fileInfos DocumentCreationInfo object.

    EchoSign also provides REST style APIs. You can access the REST API documentation at https://secure.echosign.com/public/docs/restapi/v5. You can use POST reassure API https://secure.echosign.com/public/docs/restapi/v5#! /agreements/ to send the contract and this API operation accepts also several files on demand.

    I hope this helps.

    Thank you

    Nikhil

  • Please how can I insert a value of richinputtext in the database string attribute

    Please how can I insert a value of richinputtext in the database string attribute

    If you can get its value at the bean and then call your insert statement to put it in the DB table

    and if you want to know about the execution of SQL query

    then check - Ashish Awasthi (Jdev/ADF) Blog: SQL to run in an ADF Application using DataSource DBTransaction & JDBC query

    Ashish

  • How can I insert a snapshot from one pdf to another format?

    How can I insert a snapshot from one pdf to another format?

    Hey Rodney,

    (1) Please open the pdf you want to take the picture, go to Edition & select Take Snapshot. )

    (2) make drag & select the area of the pdf file, you need to take the snapshot using your mouse.

    (3) now paste the snapshot into the paint & save it.

    (4) open the second pdf file where you want to place the snapshot in pdf editing mode, now add the image of the snapshot using the option 'Add images' on the desired place.

    Let me know if or even meet any problem.

    Kind regards

    Nicos

  • How can I insert an mp3 music file in Windows Movie Maker?

    How can I insert an MP3 of the music on Windows movie maker film?  I downloaded this song three times from Amazon.com... the file is fine.  Yet, when I'm in Windows Movie make and attempt to insert of the song, I get a message saying that the file is invalid or damaged.  The file is fine.  I'm able to import OTHER songs without problem to my film.  BUT I want this song in particular one and can't make it work.

    Convert MP3 to WMA format before importing
    in Movie Maker and you should have a better result.

    There are many freeware converters available on
    the net... the following examples may be worth a try:

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    * Proceed at your own risk *.

    (1) format Factory
    http://www.pcfreetime.com/
    (the file you want to download is: > FFSetup270.zip
    (FWIW... installation..., you might want to
    Uncheck all of the boxes on the last screen)

    First... after the download and installation of Format
    Factory... you can open the program and
    left click on the toolbar, the "Option" button and
    "Select an output folder to" / apply / OK.
    (this is where you find your files after they)
    are converted)

    Drag and drop your MP3 files on the main screen...

    Select "while"WMA"/ OK...

    Click on... Beginning... in the toolbar...

    That should do it...

    Here's another free download:

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    (2) Koyotesoft "Free MP3 WMA Converter".
    http://www.koyotesoft.com/indexEn.html
    (FWIW if you install the converter, you can
    Uncheck offerings from Yahoo and Dealio) (also... you
    may want to uncheck the CD Ripper and the Easy
    MP3 Cutter)

    After installing the program... open and drag and drop
    your audio files on the main screen...

    Choose a backup folder (path of output). Or just leave...
    "Save to the directory the file" checked and the new
    files will be saved in the folder with the current files.

    Choose a format... WMA.

    Left, click Convert.

  • How can I insert instructions/text in a PDF form text field that can be typed by the end user?

    How can I insert instructions/text into a text form field that can be typed by the end user? As the screenshot attached.

    I already have a PDF (not created by me) I have to edit but cannot work out how to enter into new fields of text instructions, I create. I tried to do in InDesign, but the text gets just covered by the blue shape box when you view the final PDF file.

    Screen Shot 2015-08-07 at 10.53.10.png

    Follow the instructions as default value for the field and then reset the form.

    See also: is there a way to add instructional text to my text field that disappears when you click on? (PDF Forms)

Maybe you are looking for