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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:07:19+00:00 2026-06-12T23:07:19+00:00

I have a problem in my codes. Obviously, I’m beginning to program in PHP

  • 0

I have a problem in my codes. Obviously, I’m beginning to program in PHP and know nothing about its advanced concepts. So I’m asking of your help. I’d like to add 2 months to the end date the user input. I tried this code below:

protected function inputEndDate() {
    $value = $this->endDate;
    $html = "";
    $html .= '<label for="enddate">End Date:</label>' . PHP_EOL;
    $html .= '<input type="text" readonly name="enddate" id="enddate" value="'.$value.'">';
    $html .= '<input type="button" id="enddatebutton" onclick="getEndDate()">' . PHP_EOL;
    return $html;
}


protected function inputExpiryDate() {
    $value = $this->endDate;
    $date = date('Y/m/d', strtotime("$value +2 month"));
    $html = "";
    $html .= '<label for="expirydate">Expiry Date:</label>';
    $html .= '<input type="text" readonly name="expirydate" id="expirydate" value="'.$date.'">';
    $html .= '<input type="button" id="expirydatebutton" onclick="getExpiryDate()">' . PHP_EOL;
    return $html;
}

But when I run the program, it’s not displaying the correct value; however it’s displaying the added two months of its start date. Please help. Thanks.

  • 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-12T23:07:21+00:00Added an answer on June 12, 2026 at 11:07 pm

    I am not sure if i understand your question.

    If i call the php function inputEndDate() it renders this html for me

    <label for="enddate">End Date:</label>
    <input type="text" readonly name="enddate" id="enddate" value="">
    <input type="button"     id="enddatebutton" onclick="getEndDate()">
    

    The value of the input-field enddate is empty because on my code $this->endDate is empty.
    Where do you get or fill $this->endDate?

    If all 3 input-fields are on the same page you need javascript to change the value of expireDate based of the input of endDate – see my updated jsfiddle-example.

    Update after review of php code

    I took a look into your code – i could not find the spot where you are filling the server-side php var this->endDate. Based on your other question how to use change event to add dates in javascript i am unsure where the problem lies.

    • If you process your php code on the server the value of expireDate must already be filled before you render the html to the client (the browser). See public function setEditBallpark() and the line $this->endDate = $this->ballparkDetails->getBallparkDetailsEndDate();
    • If the page is loaded inside the browser of the client you have only html+css+javascript available. To fill the this->endDate you have to post the value of the client to the server (normal post or ajax). In line 17 is a comment # $_POST["enddate"] but the only place that may be getting the post value is this line $this->endDate = $this->createBallparkController->getFormEndDate(); on line 75. But the method name function setErrorForm() lets me assume that this method is not relevant for the normal post case.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have downloaded follwing code from one of Google Codes but problem is in
I have a problem regarding display PHP code (stored in a database) on a
I have a problem with a Bootstrap well going beyond its containing element (here
I have a problem with my code (obviously) and after many searches on Internet,
I have problem with javascript code. I am using google maps and I am
I have problem with this code: file = tempfile.TemporaryFile(mode='wrb') file.write(base64.b64decode(data)) file.flush() os.fsync(file) # file.seek(0)
Hi i have problem with this code, i found it on the internet and
i am a beginner and i have a problem : this code doesnt compile
I have a code problem which stems from the fact that I am using
I have a problem in this code when I enter a string, instead of

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.