need help from experienced php web masters

I figured that since php is built from c it can be put here. So anyways, I'm running a local mamp server. I have the start of index.php and i want to make a form so that when they login or register it sends it to my function and they see for the title Homepage - Username or Manage Account - Username etc. Can someone please tell me what I am doing wrong in calling it?

1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
	<head>
		<title>Homepage<?php function printUser() { echo " - ".$_POST['username']; } ?></title>
	</head>	
	<body>
                <!--Here is the problem-->
		<form action="function printUser()" method="post">
			Username: <input type="text" name="username" />
			<input type="submit" />
		</form>
	</body>
</html>
closed account (j2NvC542)
You don't pass the input to a specific function, you pass it to a whole file.
If you want to pass the input into the same file as the form, you can write this:
<form action="<?php $_SERVER['SCRIPT_NAME'];?>" method="POST">

$_SERVER['SCRIPT_NAME'] is the current file name, so you don't have to update it, if you rename it.
Topic archived. No new replies allowed.