Jump to content

Echoing a variable


dudejma

Recommended Posts

set the form 'action' value to ''  (empty).

<?php
  if(isset($_POST['submit'])) { // if the form has been submitted...
   echo 'Record Added!'; // insert record into database etc here...
} else { // if the form has not been submitted, display the form...
?>
<form action='' method='post'>
<input type='submit' name='submit' value='Add Record'>
</form>
<?php
}
?>

Link to comment
https://forums.phpfreaks.com/topic/244166-echoing-a-variable/#findComment-1253924
Share on other sites

What if you have an error verification part. So, you check if the form is submitted already, then do the error verification, then you check if $errors == "". Do you put it after the verification check or still after the submit button check? Because when I put it after either one it doesn't work and when I put the end curly bracket at the very end, it makes the screen white.

Link to comment
https://forums.phpfreaks.com/topic/244166-echoing-a-variable/#findComment-1253930
Share on other sites

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.