Menu
is there anyway to take whatever form data like i have on my form and currently i have it set up on another php page that copys out what they entered and confirms it and i was just wondering if there would be anyway that i could set it up to where whenever it goes to that page the results are written in a file that way i can go in later and see what they have written im just wondering thanks in advance for all your help-
Heavy Metal
[code=php]
//creates a new file called log.txt or opens it if already exists
$file = fopen('log.txt','w+');
//writes into it things the people post
$text = $_POST['name']." wrote: ".$_POST['message']."n";
//this was just an example of course
fwrite($file,$text);
fclose($file);
[/code]
[code=php]mail (string to, string subject, string message, [optional: string additionnal headers]).[/code]
[code=php]mail("[email protected]","hello","world");[/code]
[code=php]mail($to,$subject,$message)[/code]
[code=php]$to = "[email protected]"; //you will want the mail to be sent to you, won't you ?
$subject = "New mail from my site !";
$message = $_POST['name']." wrote: ".$_POST['message']; //example of a message
if (!mail($to,$subject,$message)) {
die("Error");
}
// if for one reason the mail isn't sent, this will stop the code.
[/code]
Did you get errors...[/QUOTE]
Good you got errors. What errors were these ?[/QUOTE]
You're welcome! ?[/QUOTE]
Notice: Undefined index: what_is_it in D:Apache GroupApache2htdocsbowhuntrgpproccess.php on line 26
Notice: Undefined index: what_is_it in D:Apache GroupApache2htdocsbowhuntrgpproccess.php on line 26
but i dont know what the heck is wrong with itCould I see your code ? Or is it too personal ?
Edit: the cases in which I encountered the "Undefined Index" error were when using an array key that doesn't exist. I believe. Check for this.[/QUOTE]
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in D:Apache GroupApache2htdocsbowhuntrgpproccess.php on line 16
and thats all thats showing up on my page so what does this mean?<i>
</i><html>
<body>
<?php
$Name_on_graphic = $_POST['Name_on_graphic'];
$What_is_it = $_POST['What_is_it'];
$Color_scheme = $_POST['Color_scheme'];
$Pictures = $_POST['Pictures'];
$What_you_dont_want = $_POST['What_you_dont_want'];
$Other_info = $_POST['Other_info'];
?>
<?php
echo $Name_on_graphic.'<b>:Name On Graphic</b><br>';
echo $What_is_it.'<b>:Avatare , Signeture etc.</b><br>';
echo $Color_scheme.'<b>:Color Scheme</b><br>';
echo $Pictures.'<b>:Pictures</b><br>';
echo $What_you_dont_want.'<b>:What You Don't Want On Your Graphic</b><br>';
echo $Other_info.'<b:>Other_info</b><br>';
?>
</body>
</html>
and i checked and i cant see that its missing a ; in it so please look over it and tell me what could be causing that errorParse error: parse error, unexpected T_STRING, expecting ',' or ';' in D:Apache GroupApache2htdocsbowhuntrgpproccess.php on line 16
Right. I didn't quite understand... ? Ah yes watch out you've wrote this on your last line (or so) : <b:> which was meant to be <b>: .
If you're really really new I can only recommend the useful reading of the php tutorial on[URL]http://w3schools.com[/URL] [/QUOTE]
Notice: Undefined index: message in D:Apache GroupApache2htdocsbowhuntrgpproccess.php on line 21
error and this is my code <html>
<body>
<?php
$Name_on_graphic = $_POST['Name_on_graphic'];
$What_is_it = $_POST['What_is_it'];
$Color_scheme = $_POST['Color_scheme'];
$Pictures = $_POST['Pictures'];
$What_you_dont_want = $_POST['What_you_dont_want'];
$Other_info = $_POST['Other_info'];
?>
<?php
echo $Name_on_graphic.'<b>:Name On Graphic</b><br>';
echo $What_is_it.'<b>:Avatare , Signeture etc.</b><br>';
echo $Color_scheme.'<b>:Color Scheme</b><br>';
echo $Pictures.'<b>:Pictures</b><br>';
echo $What_you_dont_want.'<b>:What You Dont Want On Your Graphic</b><br>';
echo $Other_info.'<b>:Other_info</b><br>';
?>
<?php $to = "[email protected]";
$subject = "Gamerplanet Graphic request form !";
$message = $_POST['Name_on_graphic'].":Name On Graphic".$_POST['message'];
if (!mail($to,$subject,$message)) {
die("Error");
} ?>
</body>
</html>
[code=php]
$is_it_set=isset($_POST['message']);
[/code]
[code=php]
if(isset($_POST['message'])&&isset($_POST['Name_on_graphic']))
$message = $_POST['Name_on_graphic'].":Name On Graphic".$_POST['message'];
else
echo "a variable is not set";
[/code]
I've never got that error before, but it would make sense that "undefined index" would refer to a bad array key, and the only array you've used in that line is $_POST. As pointfiftyae said, check it with isset():
[code=php]
$is_it_set=isset($_POST['message']);
[/code]
etc.[/QUOTE]
<html>
<body>
<?php
$Name_on_graphic = $_POST['Name_on_graphic'];
$What_is_it = $_POST['What_is_it'];
$Color_scheme = $_POST['Color_scheme'];
$Pictures = $_POST['Pictures'];
$What_you_dont_want = $_POST['What_you_dont_want'];
$Other_info = $_POST['Other_info'];
?>
<?php
echo $Name_on_graphic.'<b>:Name On Graphic</b><br>';
echo $What_is_it.'<b>:Avatare , Signeture etc.</b><br>';
echo $Color_scheme.'<b>:Color Scheme</b><br>';
echo $Pictures.'<b>:Pictures</b><br>';
echo $What_you_dont_want.'<b>:What You Dont Want On Your Graphic</b><br>';
echo $Other_info.'<b>:Other_info</b><br>';
?>
<?php $to = "[email protected]";
$subject = "Gamerplanet Graphic request form !";
$message = $_POST['Name_on_graphic'].":Name On Graphic".$_POST['message'];
if (!mail($to,$subject,$message)) {
die("Error");
} ?>
<?php $is_it_set=isset($_POST['message']); ?>
</body>
</html>
text:Name On Graphic
text:Avatare , Signeture etc.
text:Color Scheme
text:Pictures
text:What You Dont Want On Your Graphic
text:Other_info
Notice: Undefined index: message in D:Apache GroupApache2htdocsbowhuntrgpproccess.php on line 21
<?php $is_it_set=isset($_POST['message']); ?>
[/QUOTE]
[code=php]
if(isset($_POST['message'])&&isset($_POST['Name_on_graphic']))
$message = @$_POST['Name_on_graphic'].":Name On Graphic".@$_POST['message'];
else
echo "a variable is not set";
[/code]
Okay, I assume all of the form values from the previous page were just set to "text".
You've done that wrong.
It seems that 'message' is an invalid array reference. check the form that posted to that script, and check that there is a field named "message". Bear in mind that it may be case-sensitive, I'm not sure.
The way you should set up the isset is as I explained before:
[code=php]
[/QUOTE]
if(isset($_POST['message'])&&isset($_POST['Name_on_graphic']))
$message = @$_POST['Name_on_graphic'].":Name On Graphic".@$_POST['message'];
else
echo "a variable is not set";
[/code]
[code=html]<html>
<head>
<title>Gamerplanet Graphic request form</title>
</head>
<body bgcolor="black" text="white">
<center><h1>Gamerplanet Graphic Request Form</h1></center>
<form method="post" action="/gpproccess.php" onReset="return confirm('Do you really want to Reset this form?')" onSubmit="return confirm('Do you really want to submit this form?')">
<input type="text" name="Name_on_graphic" Size="50"><b>Name On Graphic</b><br>
<hr>
<input type="text" name="What_is_it" size="50"><b>Avatare , Signeture etc.</b><br>
<hr>
<input type="text" name="Color_scheme" size="50"><b>Color Scheme</b><br>
<hr>
<TEXTAREA NAME="Pictures" ROWS="10" COLS="40"></textarea><b>Pictures(you must provide them)</b><br>
<hr>
<TEXTAREA NAME="What_you_dont_want" ROWS="10" COLS="40"></textarea><b>What You Don't Want On Your Graphic</b><br>
<hr>
<TEXTAREA NAME="Other_info" ROWS="10" COLS="40"></textarea><b>Other Info</b><br>
<hr>
<input type="submit" value="Submit"><input type="reset" Value="Reset">
</form>
</body>[/code]
As I thought, your form contains no <input> named "message", so you cannot receive $_POST['message'], because no 'message' variable has been posted to the script.
What exactly do you expect $_POST['message'] to contain?
By the way, I just can't resist the urge to correct your spellings. It's [B]avatar[/B] not avatare and [B]signature[/B] not signeture[/QUOTE]
[code=php]
mail("[email protected]","Gamerplanet Graphic Request Form",$message);
[/code]
[code=php]$Name_on_graphic = $_POST['Name_on_graphic'];
$What_is_it = $_POST['What_is_it'];
$Color_scheme = $_POST['Color_scheme'];
$Pictures = $_POST['Pictures'];
$What_you_dont_want = $_POST['What_you_dont_want'];
$Other_info = $_POST['Other_info'];[/code]
so im guessing that yes want im trying to do here is put all of those into one variable called message[code=php]
$Name_on_graphic = $_POST['Name_on_graphic'];
$What_is_it = $_POST['What_is_it'];
$Color_scheme = $_POST['Color_scheme'];
$Pictures = $_POST['Pictures'];
$What_you_dont_want = $_POST['What_you_dont_want'];
$Other_info = $_POST['Other_info'];
$message="Application form received:nn$Name_on_graphic.$What_is_it.$Color_scheme.$Pictures.$What_you_dont_want.$Other_info;
mail("[email protected]","Gamerplanet Graphic Request Form",$message);
[/code]
[code=php]<html>
<body>
<?php
$Name_on_graphic = $_POST['Name_on_graphic'];
$What_is_it = $_POST['What_is_it'];
$Color_scheme = $_POST['Color_scheme'];
$Pictures = $_POST['Pictures'];
$What_you_dont_want = $_POST['What_you_dont_want'];
$Other_info = $_POST['Other_info'];
?>
<?php
echo $Name_on_graphic.'<b>:Name On Graphic</b><br>';
echo $What_is_it.'<b>:Avatare , Signeture etc.</b><br>';
echo $Color_scheme.'<b>:Color Scheme</b><br>';
echo $Pictures.'<b>:Pictures</b><br>';
echo $What_you_dont_want.'<b>:What You Dont Want On Your Graphic</b><br>';
echo $Other_info.'<b>:Other_info</b><br>';
?>
<?php $message="Application form received:nn$Name_on_graphic.$What_is_it.$Color_scheme.$Pictures.$What_you_dont_want.$Other_info;
mail("[email protected]","Gamerplanet Graphic Request Form",$message);
if (!mail($to,$subject,$message)) {
die("Error");
} ?>
</body>
</html>[/code]
is outputing[code=php]Parse error: parse error, unexpected T_STRING in D:Apache GroupApache2htdocsbowhuntrgpproccess.php on line 21[/code]
[code=php]<html>
<body>
<?php
$Name_on_graphic = $_POST['Name_on_graphic'];
$What_is_it = $_POST['What_is_it'];
$Color_scheme = $_POST['Color_scheme'];
$Pictures = $_POST['Pictures'];
$What_you_dont_want = $_POST['What_you_dont_want'];
$Other_info = $_POST['Other_info'];
?>
<?php
echo $Name_on_graphic.'<b>:Name On Graphic</b><br>';
echo $What_is_it.'<b>:Avatare , Signeture etc.</b><br>';
echo $Color_scheme.'<b>:Color Scheme</b><br>';
echo $Pictures.'<b>:Pictures</b><br>';
echo $What_you_dont_want.'<b>:What You Dont Want On Your Graphic</b><br>';
echo $Other_info.'<b>:Other_info</b><br>';
?>
<?php $message="Application form
received:nn".$Name_on_graphic.$What_is_it.$Color_scheme.$Pictures.$What_you_dont_want.$Other_info;
if(!mail("[email protected]","Gamerplanet Graphic Request Form",$message))
die("Error");
} ?>
</body>
</html>[/code]
[code=php]Parse error: parse error, unexpected '}' in D:Apache GroupApache2htdocsbowhuntrgpproccess.php on line 24[/code]
Between the strings
[/QUOTE]
No problem. You need to learn how to fix your own errors though. Just look at the line specified by the error. It normally gives you a hint, for example unexpected (character) means that whatever character is there either shouldn't be there, or something should be before it. T_STRING refers to a string, T_VARIABLE to a variable, etc.
[B]Hint:[/B] It's also a good idea to check to make sure you haven't missed any ';'s, and to make sure that all strings are closed off.[/QUOTE]
0.1.9 — BETA 5.17