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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:56:50+00:00 2026-06-10T04:56:50+00:00

Excuse me for the title, it was a bit hard to explain my problem.

  • 0

Excuse me for the title, it was a bit hard to explain my problem. So here it is. On http://appsolute.vacau.com/cms I have a variable in the textarea. You see the output of the variable from start. Updating the text en submitting the form IS updating the variable. Thus far everything is right, right? On submitting the form, the page is reloaded, but all the content is from the previous content of the variable. But when checking, the variable WAS updated. Even if you refresh the page.
So why don’t I get to see the actual value of the variable after submitting the form?
Hope it makes sense…

<html>
    <head>
        <title>Milan CMS</title><?php
$host     = "x";
$dbname   = "x";
$username = "x";
$password = "x";
$dbh      = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
$sth      = $dbh->prepare("SELECT * FROM milan   ");
$sth->execute();
$result   = $sth->fetchAll();
?>
    </head>

    <body>
        <?php
        var_dump($result);
        $myFile   = "trainingen.json";
        $fh       = fopen($myFile, 'w') or die("can't open file");
        fwrite($fh, json_encode($result));
        fclose($fh);
        ?>
        <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="trainingen">
            <h3>Trainingen:</h3><p><textarea name="nametrainingen" rows="10" cols="60"><?php echo $result[0]['value']; ?></textarea></p>
            <input name="submit" type="submit" value="Verzenden"><input type="reset" value="Veld leeg maken">
        </form>
        <?php
        $invoer   = $_POST['nametrainingen'];
        if (isset($_POST['submit'])) { //test if submit button is clicked
            $sql = "DELETE FROM milan WHERE tag = 'trainingen'";
            $sth = $dbh->prepare($sql);
            $sth->execute();
            $sql = "INSERT INTO milan (tag, value) VALUES ('trainingen', '$invoer')";
            $sth = $dbh->prepare($sql);
            $sth->execute();
        }
        ?>
    </body>
</html>
  • 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-10T04:56:52+00:00Added an answer on June 10, 2026 at 4:56 am

    re-arrange the logic like so:

    <?php
            $invoer   = $_POST['nametrainingen'];
            if (isset($_POST['submit'])) { //test if submit button is clicked
                $sql = "DELETE FROM milan WHERE tag = 'trainingen'";
                $sth = $dbh->prepare($sql);
                $sth->execute();
                $sql = "INSERT INTO milan (tag, value) VALUES ('trainingen', '$invoer')";
                $sth = $dbh->prepare($sql);
                $sth->execute();
            }
    
            $sth      = $dbh->prepare("SELECT * FROM milan   ");
            $sth->execute();
            $result   = $sth->fetchAll();
        ?>
           <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="trainingen">
                <h3>Trainingen:</h3><p><textarea name="nametrainingen" rows="10" cols="60"><?php echo $result[0]['value']; ?></textarea></p>
                <input name="submit" type="submit" value="Verzenden"><input type="reset" value="Veld leeg maken">
            </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Excuse the title, but it's best I just explain the problem. I have 2
Please excuse the awkward title I'll try my best to explain my peculiar problem.
Please excuse the poorly worded title, hopefully I can explain the issue here. I've
The title is a bit complicated, but it fits my problem. I have a
Excuse the poor title, i can not think of the correct term. I have
excuse me in advance if this is not the right title for the problem
First of all, excuse my poor topic title. I simply have no idea how
Excuse the terrible question title. I have this PHP string and want to check
Excuse the phrasing of the title but it was kind of hard to sum
Please excuse the vagueness of my title, I really don't know how to succinctly

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.