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