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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:41:45+00:00 2026-05-29T18:41:45+00:00

How can I say in/with the follow (see below) function that you can make

  • 0

How can I say in/with the follow (see below) function that you can make max 3 items? And if you will make more than three items the function will stop and you get a warning?

function addSection() {
global $compid;
    $sectionOb = new Item();
    $sectionOb->i_id_pk = $sectionOb->newId();
    $sectionOb->i_mod_comp_id_fk = $compid;
    $sectionOb->c_titel = '';
    $sectionOb->c_content = '';
    $sectionOb->i_sort = $sectionOb->newSort($compid);
    $sectionOb->insert();
}

if($action == 'add') {  
    addSection();
}


<a href="<?php echo $_SERVER['REQUEST_URI'] ?>&amp;action=add" />new section</a>
  • 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-05-29T18:41:50+00:00Added an answer on May 29, 2026 at 6:41 pm

    If you are not too concerned about URL spoofing, I would add a counter variable in the URL which is passed to the addSection() method like so:

    function addSection($count) {
        if ($count >= 3) { return $count; }
        global $compid;
        $sectionOb = new Item();
        $sectionOb->i_id_pk = $sectionOb->newId();
        $sectionOb->i_mod_comp_id_fk = $compid;
        $sectionOb->c_titel = '';
        $sectionOb->c_content = '';
        $sectionOb->i_sort = $sectionOb->newSort($compid);
        $sectionOb->insert();
    
        // Return incremented count
        return $count + 1;
    }
    

    // Retrieve the last count from the URL
    $count = isset($_GET['count']) ? intval($_GET['count']) : 0;
    
    // Increment the count if the action is add and the addSection method suceedes
    if($action == 'add') {  
        $count = addSection($count); 
    }
    
    // Add count to the URL so we know what it is
    <a href="<?php echo $_SERVER['REQUEST_URI'] ?>&action=add&count=<?php echo $count; ?>" />new section</a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my application, I would like to have DataTemplates such that I can say:
Can anybody say me, why that isn't working: class A attr_accessor :b end a
Can we say passing a function pointer as an argument to a function is
This inheritance is found in ADO.Net. Can we say that here both the design
There are other posts that say you can create a control in windows forms
Lets say the same grammar is not LR(1), can we safely say that the
**Updated: (See below)**I have been looking around for couple of days and can't find
Say I have function X in file A, and I wanted to move that
Are there any programs that will allow you to follow a sql transaction through
Say that I have an application where user can upload his avatar, and then

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.