I have created a form in HTML and a processing script in PHP. When I hit the send button, nothing happens.
My HTML Form:
<form method="post" action="../core/code/php/notes.php" id="sendNote">
<input type="hidden" name="sender" value="user">
<ol>
<li><label for="sendto">Send to:</label></li>
<li>
<select name="sendto">
<option value="admin">admin</option>
<option value="bnguyen654">bnguyen654</option>
</select>
</li>
<li><label for="message">Message:</label></li>
<li><textarea name="message" style="font-family:'Charter BT';"></textarea></li>
<li><input type="button" value="Send" name="send"></li>
</ol>
</form>
My PHP Code:
<?php
$to = $_REQUEST['sendto'];
$from = $_REQUEST['sender'] ;
$message = $_REQUEST['message'];
if($message == '') {echo '<script type="text/javascript"> alert("You have not entered a message, please go back and try again"); history.go(-1)</script>';}
else {
$file = "../../../Admin/%to/notes.txt";
$fh = fopen($myFile, 'a') or die("Can't find file");
$stringData = "%message ~%from";
$send = fwrite($fh, $stringData);
fclose($fh);
if($send)
{echo '<script type="text/javascript"> alert("Message sent successfully"); window.location={"../../../Admin"};</script>';}
else {
{echo "We encountered an error sending your message, please try again."; }
}
}
?>
The send button does nothing. No success message or error. This is really frustrating. I do tend to overlook things thought so...
- This is on a server
The links are correct
I know it's a lot to go through
- Any help would be appreciated
Thanks, ~BN