Jump to content

Recommended Posts

this sounds more like an application for javascript, however the best idea to handle this in php would be to initialze a testing scheme using regex pre loading the body.  Place it in a function like this

Function testvars
{
//Testing vars
if (allpass)
{$returnvar = "yes";}
{else $returnvar = "no";}
return $returnvar;
}
$test = testvars();
if ($test == "yes")
{
header(location:process.php)
}
else
{//Load error box and set astriks}

Link to comment
https://forums.phpfreaks.com/topic/56000-web-form-help/#findComment-276585
Share on other sites

if you can have those data that the user input then its not gonna be the prob but if it is its still a long journey

 

any way your are what trying to say is upon submitting an u use php self

 

====

check all the data that is submitted and try the if condition

 

 

<?if (!isset($_POST['your variable here'])) echo "*";?>  <input name="" type="text" />

 

hope that helps

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/56000-web-form-help/#findComment-276586
Share on other sites

<?php
function check($form_name) {
if ($_POST['submit']) {
    	if (empty($_POST[$form_name])) {
        	echo '*';
        }
    }
}
?>

<form method="POST" action="<?=$_SERVER['PHP_SELF'];?>">
  <input type="text" name="T1" size="20"><? check("T1"); ?><br>
  <input type="text" name="T2" size="20"><? check("T2"); ?><br>
  <input type="text" name="T3" size="20"><? check("T3"); ?><br>
  <input type="submit" value="Submit" name="submit">
</form>

 

Hope this helps..

Link to comment
https://forums.phpfreaks.com/topic/56000-web-form-help/#findComment-276588
Share on other sites

empty means variable is empty... the integer 0 is considered empty, as is "0" in a string

 

isset checks if variable exists, including the values above

 

$_POST['form_name'] == ''

 

the problem with that is the user could still supply irrelevant information and pass that check, ie whitespace or any number of other things.

Link to comment
https://forums.phpfreaks.com/topic/56000-web-form-help/#findComment-276593
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.