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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:26:32+00:00 2026-06-03T23:26:32+00:00

Can anybody see what is wrong with my code? I am trying to create

  • 0

Can anybody see what is wrong with my code?

I am trying to create a calendar event for every event that is in the $_POST. There should be one calendar for download with several events on it.

So far it will generate a calendar file for download with the last event in the list only. It writes over the old ones.

Thanks in advance for any help.

 //Set the headers
 header("Content-Type: text/Calendar");
 header("Content-Disposition: inline; filename=calendar.ics");

 //Loop through $_POST to get all entries

 foreach ($_POST['listItem'] as $value){

$dave = trim($value);

echo "BEGIN:VCALENDAR\n";
echo "VERSION:2.0\n";
echo "PRODID:www.testMeiCalendar.net\n";
echo "METHOD:REQUEST\n"; // requied by Outlook
echo "BEGIN:VEVENT\n";
echo "DTSTART:".$dave."T230000\n";
echo "DTEND:".$dave."T010000\n";
echo "SUMMARY:This is beautiful\n";
echo "LOCATION:Downtown\n";
echo "DESCRIPTION:Let's get together for New Years Eve\n";
echo "UID:ABCD1234\n";
echo "SEQUENCE:0\n";
echo "DTSTAMP:20101125T112600\n";
echo "END:VEVENT\n";
echo "END:VCALENDAR\n";

  }
  • 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-03T23:26:33+00:00Added an answer on June 3, 2026 at 11:26 pm

    Without knowing the structure of the $_POST sent to your script I’d say that there is only a single value in listItem and so that’s why it does not give output for everything. Have you debugged it to tell if it is only outputting a single value or if it’s actually outputting everything and overwriting?

    __

    The answer at How to get multiple parameters with same name from a URL in PHP from benlumley suggests appending [] to the end of the variable name for GET requests.

    IE:

    someurl.php?name[]=aaa&name[]=bbb

    will give you a $_GET looking like:

    array(0=>’aaa’, 1=>’bbb’)

    EDIT: I think the answer may be as simple as:

    foreach($_POST['listItem'] as $key => $value)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anybody see what is wrong with this code. it does not show up
Can anybody see where I am going wrong with this? I am trying to
Can anybody see what's wrong with my code? It behaves properly in IE but
Can anybody guide me in the right direction... I have some folder strucktures that
Does anybody see anything wrong with the following function? ( Edit : no, I
Can anybody give me an example how to use the osgi framework classes? I
Can anybody know how to remove all the indexes from database ?
Can anybody please tell me what is the use of %NOTFOUND operator? We can
Can anybody tell me how to parse and edit HTML in PHP?
Can anybody tell me how to search for available iPhone/iPod devices on a network

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.