nachtegaal9999 Posted August 8, 2009 Report Share Posted August 8, 2009 HoiI have a question , somebody fills in his name on my website in fieldname "htmlname"Code<html><body><br><input type="text" name="HTMLname" /><br>Next , i want to declare this input as a php variable with the next php code: <?php$PhpVarNaam='HTMLnaam'; echo Filled in name : $PhpVarName;?>This isn't correct, i get "HTMLname" as result, but this is wrongWho can help with this little issue?Thanks in advance Link to comment Share on other sites More sharing options...
smerny Posted August 8, 2009 Report Share Posted August 8, 2009 (edited) first of all, your input field has to be within a form... and make a submit button...like this <form action='mypage.php' method='post'><input type="text" name="HTMLname" /><input type='submit' name='submit' value='submit'></form> what this code means is that when you hit the submit button, it will load "mypage.php" and give $_POST['HTMLname'] the value that is enteredso on mypage.php you could have the code <?php$PhpVarName=$_POST['HTMLname']; echo "Filled in name : ".$PhpVarName;?> and make sure you spell stuff correct.... Edited August 8, 2009 by smerny Link to comment Share on other sites More sharing options...
Synook Posted August 8, 2009 Report Share Posted August 8, 2009 If you just want to pass data from page to page generally, use sessions. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now