html - PHP isset() usage -
okay let me sum briefly. have 2 textboxes made in html. want whatever typed there stored 2 variables, want page 2 things, one, want set submit button(using isset) not display error @ beginning. how this, suppose 2 variables $textbox1 , $textbox2. error undefined variable on line 26 html textbox2 located. note value of textbox variable. if don't understand me, scroll bottom of code see i'm talking about.
<?php if (isset($_post['submit'])) { $textbox1 = $_post['txtbox1'] && $textbox2=$_post['txtbox2']; if ($textbox1=="john" && $textbox2="doe") { print ("welcome friend"); } else { print ("you're not member of site"); } } else { $textbox1="" && $textbox2=""; } print($textbox1 && $textbox2); ?> <input type="text" value="<?php print($textbox2); ?>" name=txtbox2>
&& logic operator. can't use set multiple variables in single line. so
$textbox1 = $_post['txtbox1'] && $textbox2=$_post['txtbox2']; should read
$textbox1 = $_post['txtbox1']; $textbox2 = $_post['txtbox2']; also, you're using assignment (=) instead of equality check (==) in second conditional.
if ($textbox1=="john" && $textbox2="doe") { should read
if ($textbox1 == 'john' && $textbox2 == 'doe') { again, in else , print() afterwards, you're attempting use logic operators when shouldn't be. in else, split 2 separate lines shown above, , in print() statement should using concatenation, not &&.
i don't understand you're trying accomplish here, these problems see code.
Comments
Post a Comment