Jump to content

validating on same page


ali_2kool2002

Recommended Posts

Um, you code it and if it doesn't work we'll help you fix it.

 

You want one of two things: either put your PHP validation above all the other HTML on the page, and make the form action post/get to itself (ie, <form action="" method="post">).  Or, you can use Javascript, have it pull the values of the objects from the DOM, validate it, then send you on to the next page if it passes.

 

If you don't want to do a page refresh, you need PHP + Ajax, check out the tutorials on www.ajaxfreaks.com for more info.

hi can anyone code something that will check once a button is clicked if there is a value selected in a combo box on the same page instead of moving to another page which handles the validation :-*?

 

<?php
$sub = $_REQUEST['sub'];
$combo = $_RESUEST['combo'];
   if (!isset($sub))
   {
       enter();
   }
   else if ($sub)
  { 
      validation($combo);
  }

function enter()
{
  // action depening on what you want done if there is no submission in the $sub varable i.e. HTML form asking for input from a combo box
 // the $sub varable will be passed by <input type="hidden" name="sub" value="1"> in the HTML element of the form.
}
function validation($combo)
{
 // action depending on what you want done once you have that information and the form has been submitted
}
?>

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.