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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:45:24+00:00 2026-05-14T15:45:24+00:00

Although probarly quite simple, i cannot seem to find the following. The form takes

  • 0

Although probarly quite simple, i cannot seem to find the following.
The form takes certain data, and then represents the data in a table.

Next step i click the hyperlink that takes me back to the form.
Now my question is how exactly do i make it possible when filling in the same form again so both results are displayed in the same table?
Then filling in a other form with data adds another row and so on.

Regards.

The code below (pardon me that it is not english).

<?php
session_start();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0            Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title>ExpoFormulier</title>

<body>

<?php
if (!empty($_POST))
{
$standnaam = $_POST["standnaam"];
$oppervlakte = $_POST["oppervlakte"];
//value in the form van checkboxes op 1 zetten!
$verdieping = isset($_POST["verdieping"]) ? $_POST["verdieping"] : 0;  //if checkbox    checked value 1 anders 0
$telefoon = isset($_POST["telefoon"]) ? $_POST["telefoon"] : 0;  
$netwerk = isset($_POST["netwerk"]) ? $_POST["netwerk"] : 0; 


if (is_numeric($oppervlakte)) 
{
    $_SESSION["standnaam"]=$standnaam;
    $_SESSION["oppervlakte"]=$oppervlakte;
    $_SESSION["verdieping"]=$verdieping;
    $_SESSION["telefoon"]=$telefoon;
    $_SESSION["netwerk"]=$netwerk;
    header("Location:ExpoOverzicht.php"); //verzenden naar ExpoOverzicht.php dmv header
}
else 
{
    echo "<h1>Foute gegevens, Opnieuw invullen a.u.b</h1>";
}  
}

?>

<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post" id="form1">
<h1>Vul de gegevens in</h1>
<table>
    <tr>
        <td>Standnaam:</td>
        <td><input type="text" name="standnaam" size="18"/></td>
    </tr>
    <tr>
        <td>Oppervlakte (in m^2):</td>
        <td><input type="text" name="oppervlakte" size="6"/></td>
    </tr>
    <tr>
        <td>Verdieping:</td>
        <td><input type="checkbox" name="verdieping" value="1"/></td>
        <!--value op 1 zetten voor checkbox! indien checked is value 1 -->
    </tr>
    <tr>
        <td>Telefoon:</td>
        <td><input type="checkbox" name="telefoon" value="1"/></td>
    </tr>
    <tr>
        <td>Netwerk:</td>
        <td><input type="checkbox" name="netwerk" value="1"/></td>
    </tr>
    <tr>
        <td><input type="submit" name="verzenden" value="Verzenden"/></td>
    </tr>
</table>

</form>

Second File:

<?php
session_start();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
    <title>ExpoOverzicht</title>
 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <link href="StyleSheetExpo.css" rel="stylesheet" type="text/css" />  
</head>

<body>

<h1>Overzicht van de ingegeven standen in deze sessie</h1>

<?php

$standnaam = $_SESSION["standnaam"];
$oppervlakte = $_SESSION["oppervlakte"];
$verdieping = $_SESSION["verdieping"];
$telefoon = $_SESSION["telefoon"];
$netwerk = $_SESSION["netwerk"];

$result1 = 0; //telkens declaren anders fout "undefined variable"
$result2 = 0;
$result3 = 0;
$prijsCom = 0;
$prijsVerdieping = 0;

for ($i=1; $i <= $oppervlakte; $i++)
{   
    if($i <= 10)
    {
       $tarief1 = 1 * 100;
       $result1 += $tarief1;
    }

    if($i > 10 && $i <= 30)
    {
        $tarief2 = 1 * 90;
        $result2 += $tarief2;      
    }

    if($i > 30)
    {
        $tarief3 = 1 * 80;
        $result3 += $tarief3;
    }  
}
$prijsOpp = $result1 + $result2 + $result3;


if($verdieping == 1)
{
    $prijsVerdieping = $oppervlakte * 120;
}


if(($telefoon == 1) || ($netwerk == 1)) // eerst deze OR conditie  of anders gebruikt de code alleen nog maar 20
{
    $prijsCom = 20;
}

if(($telefoon == 1) && ($netwerk == 1))
{
    $prijsCom = 30;
}


$totalePrijs = $prijsOpp + $prijsVerdieping + $prijsCom; 

echo "<table class=\"tableExpo\">";

    echo "<th>Standnaam</th>";
    echo "<th>Oppervlakte</th>";
    echo "<th>Verdieping</th>";
    echo "<th>Telefoon</th>";
    echo "<th>Netwerk</th>";
    echo "<th>Totale prijs</th>";

        echo "<tr>";     
            echo "<td>".$standnaam."</td>";
            echo "<td>".$oppervlakte."</td>";
            echo "<td>".$verdieping."</td>";
            echo "<td>".$telefoon."</td>";
            echo "<td>".$netwerk."</td>";
            echo "<td>".$totalePrijs."</td>";
        echo "</tr>";

echo "</table>";

?>

<a href="ExpoFormulier.php">Terug naar het formulier</a>

</body>
</html>

</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-05-14T15:45:24+00:00Added an answer on May 14, 2026 at 3:45 pm

    Your session variables will only store the last piece of data entered. Rather than storing them in the session as simple variables, try putting an array in the session. Then when the form is submitted again, add another entry to those arrays. That way you won’t overwrite what was previously there.

    ETA:

    On Page 1, where you set the session variables, try this:

    $_SESSION["standnaam"][]=$standnaam;
    $_SESSION["oppervlakte"][]=$oppervlakte;
    $_SESSION["verdieping"][]=$verdieping;
    $_SESSION["telefoon"][]=$telefoon;
    $_SESSION["netwerk"][]=$netwerk;
    

    On Page 2, where you write out the table rows, try this:

    for($i = 0; $i < count($standnaam); $i++) {
        echo "<tr>";     
            echo "<td>".$standnaam[$i]."</td>";
            echo "<td>".$oppervlakte[$i]."</td>";
            echo "<td>".$verdieping[$i]."</td>";
            echo "<td>".$telefoon[$i]."</td>";
            echo "<td>".$netwerk[$i]."</td>";
            echo "<td>".$totalePrijs[$i]."</td>";
        echo "</tr>";
    }
    

    I think that aught to do it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My problem is probably quite simple, but somehow I can’t get it fixed. In
although there's quite a bit of information about recursion on the web, I haven't
I am extremely new to PHP and, although I am quite familiar to javascript,
Ok, I am probably missing something obvious, and although I've tried to find a
I can't quite seem to get my head around linear animation, as basic as
It feels like jQuery is messing with me, although it's probably a simple issue.
I think its quite a simple question but not sure. I have a class:
I've been searching around trying to find an answer both here and google, although
Although this code is from an algorithm text, I have a bit of a
Although appengine already is schema-less, there still need to define the entities that needed

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.