Jump to content

check input value dont work


web_master

Recommended Posts

Hi,

 

I try to check input valu, when somebody enter his name in form, but its dont work...

 

step 1: the form is empty

step 2: if the form is still "empty" (only the "generic" text is in)

step 3: user is enter the text

 

what Im I do wrong?

 

<?php 

// POST submit
if($_POST['submit']) {

// step 1
if($_POST['user'] == "") {

if($_POST['lg'] == "hu") {$user_print = "EMPTY ON HU";}
if($_POST['lg'] == "es") {$user_print = "EMPTY ON ES";}

$user = $user_print;

// step 2
} elseif($_POST['user'] == $user_print) {

if($_POST['lg'] == "hu") {$user_print2 = "EMPTY ON HU2";}
if($_POST['lg'] == "es") {$user_print2 = "EMPTY ON ES2";}

$user = $user_print2;
// step 3
} else {
$user = $_POST['user'];
}

} // end of POST submit
?>

<form action="<?php print $_SERVER['PHP_SELF'];?>" method="post">
<input type="text" name="user" value="<?php print $user;?>" />
<input type="submit" name="submit" />
<input type="hidden" name="lg" value="hu" /><!-- or value="es" -->
</form>

Link to comment
https://forums.phpfreaks.com/topic/115684-check-input-value-dont-work/
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.