Jump to content

sending and reading data on the same page


peuge

Recommended Posts

I have made a simple table in PHP and I want to send the entered data to the same page. Once this is done I want to read it from the same page. Is this possible or do I have to send it to another page?

 

echo "<table>";

echo "<form method=post action=What do I put here]>";

echo "<input type=text name=num id=num>";

echo "<input type=submit name=submit value=submit>";

echo "</form>";

echo "</table>";

<?php

if (isset($_POST['submit'])) {
  echo $_POST['num'];
} else {
  echo "<table>";
  echo "<form method=post action=''>";
  echo "<input type=text name=num id=num>";
  echo "<input type=submit name=submit value=submit>";
  echo "</form>";
  echo "</table>";

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.