Jump to content

Little Problem Html<>php Variable


nachtegaal9999
 Share

Recommended Posts

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

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 by smerny
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...