noob can't even make a function work right :-(



this file gives the next file its post data (username and request)
------------------------------------------------------------
<html>
<head>
<script language="JavaScript" type="text/javascript">
<!--
function killit(s){
s.disabled = true;
s.value = "Loading... "}
//-->
</script>

</head>
<body>
<form action="writetofile.php" method="POST">
Name: <input type="text" name="username"><br>
Request: <input type="text" name="request"><br>
<hr>
<input type="submit" value="Submit my request!" onClick="killit(this)">
</form>
</body>
</html>

this file SHOULD write those values to file.txt and then show them
unless $uName has no value
-----------------------------------------
<html>
<body>
<?php

global $myFile, $fh, $uName, $pRequest;

$myFile = "file.txt";
$fh = fopen($myFile, 'a+') or die("can't open file");
$uName = $_POST['username'];
$pRequest = $_POST['request'];

function makeSure($myFile, $fh, $uName, $pRequest){

if ($uName == ''){
echo 'You must go back and complete the form to make a request.';}

else {
$stringData = "$uName<br/>";
fwrite($fh, $stringData);

$stringData = "$pRequest<hr/>";
fwrite($fh, $stringData);
fclose($fh);}}

$myFile = "file.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
fclose($fh);

echo "$theData";
?>
I want to <a href="http://here.com/";>make a request</a>.
</body>
</html>
--------------------------------------
i've tried this somany ways its getting boring... i already pasted the
pissed off point and i am now becoming bored... :-|

PLEASE HELP THE NOOB! I KNOW THE FIX IS AND OBVIOUS MISTAKE IM MAKING
BUT I DON'T KNOW WHAT IT IS! :-(


thanks all,
-woody

.



Relevant Pages