peuge Posted March 26, 2008 Share Posted March 26, 2008 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>"; Link to comment https://forums.phpfreaks.com/topic/98002-sending-and-reading-data-on-the-same-page/ Share on other sites More sharing options...
trq Posted March 26, 2008 Share Posted March 26, 2008 <?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>"; } Link to comment https://forums.phpfreaks.com/topic/98002-sending-and-reading-data-on-the-same-page/#findComment-501438 Share on other sites More sharing options...
peuge Posted March 26, 2008 Author Share Posted March 26, 2008 Thanks that helps loads with what I am actually trying to accomplish! Link to comment https://forums.phpfreaks.com/topic/98002-sending-and-reading-data-on-the-same-page/#findComment-501441 Share on other sites More sharing options...
conker87 Posted March 26, 2008 Share Posted March 26, 2008 You could also do: action='{$_SERVER['REQUEST_URI']}' But either works fine. Link to comment https://forums.phpfreaks.com/topic/98002-sending-and-reading-data-on-the-same-page/#findComment-501472 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.