rebbeca
-
Posts
8 -
Joined
-
Last visited
Never
Posts posted by rebbeca
-
-
I'm really sorry and I'm sure I'm testing your patience to an extreme, I copied your code word for word but I now get the following error.....
0http://rebbeca.info/newsite/pages/csssite/album.php
Warning: Cannot modify header information - headers already sent by (output started at \\filer01\soho\rebbeca.info\www.rebbeca.info\web\content\newsite\pages\csssite\dlalbum.php:11) in \\filer01\soho\rebbeca.info\www.rebbeca.info\web\content\newsite\pages\csssite\dlalbum.php on line 44
-
thanks, now I get the following error:
Parse error: parse error, unexpected T_VARIABLE in \\filer01\soho\rebbeca.info\www.rebbeca.info\web\content\newsite\pages\csssite\dlalbum.php on line 3
I looked up ob_Start and it looks like there should be something in brackets after the ob_Start, is this the case?
Just as an update, here is what the php file is now looking like:
<?
ob_start
$errors = 0;
$ref = $_SERVER['HTTP_REFERER'];
$email = $_POST['YPML0'];
$mobile = $_POST['YPML1'];
$location = $_POST['YPML2'];
$wherehear = $_POST['YPML3'];
$favesong = $_POST['YPML4'];
echo $errors = 0;
echo $ref;
echo $email;
echo $mobile;
echo $location;
echo $wherehear;
echo $favesong;
// User entered email on form?
if(!$email || strlen($email = trim($email)) == 0){
$errors += 1;
}
// Checks to see if email address is of valid type
$regex = "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)*"
."@[a-z0-9-]+(\.[a-z0-9-]{1,})*"
."\.([a-z]{2,}){1}$";
if(!eregi($regex,$email)){
$errors += 1;
}
// User entered location?
if(!$location || strlen($location = trim($location)) == 0){
$errors += 1;
}
// User entered where they heard about rebbeca?
if(!$wherehear || strlen($wherehear = trim($wherehear)) == 0){
$errors += 1;
}
// User entered their fave song?
if(!$favesong || strlen($favesong = trim($favesong)) == 0){
$errors += 1;
}
// If any errors were returned go back to the form
if ($errors > 0) {
header("location: ".$ref);
exit();
}
// Construct email
$to = "info@rebbeca.info";
$from = "From: Rebbeca <album@rebbeca.info>\n";
$subject = "Album Downloaded!";
$body = "E-mail address: ".$_POST['YPML0']."\n";
if ($_POST['YPML1']) {
$body .= "Mobile number: ".$_POST['YPML1']."\n";
}
$body .= "Location (city / country): ".$_POST['YPML2']."\n";
$body .= "First heard about Rebbeca: ".$_POST['YPML3']."\n";
$body .= "Favourite Song: ".$_POST['YPML4']."\n";
// Send it
mail($to,$subject,$body,$from);
// Commence download
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="musicbynumbers.zip"');
@readfile("http://www.rebbeca.info/music-by-numbers/musicbynumbers.zip");
?>
Thanks
-
I've added the echo code I wrote above, I've done it just below where the variables are defined. Now when I fill out the form and press submit I get the following message...
0http://rebbeca.info/newsite/pages/csssite/album.php
Warning: Cannot modify header information - headers already sent by (output started at \\filer01\soho\rebbeca.info\www.rebbeca.info\web\content\newsite\pages\csssite\dlalbum.php:10) in \\filer01\soho\rebbeca.info\www.rebbeca.info\web\content\newsite\pages\csssite\dlalbum.php on line 43
-
ok, I've looked up echo code, I never wrote that php code if anyone is wondering how I wrote that without knowing what something basic like an echo is.
So what do I need to echo? The variables?
Woudl this be as follows?
echo $errors = 0;
echo $ref;
echo $email;
echo $mobile;
echo $location;
echo $wherehear;
echo $favesong;
Again thanks for any help in advance
-
Form code is as follows:
<form method="post" action="dlalbum.php">
<table border="0">
<tr>
<td colspan="2"><strong>Fill out this form to download the album for free</strong></td>
</tr>
<tr>
<td>E-mail address:</td>
<td><input type="text" name="YMLP0" size="20"></td>
</tr>
<tr>
<td>Mobile number (optional):</td>
<td><input type="text" name="YMLP1" size="20"></td>
</tr>
<tr>
<td>Where do you live? (city / country):</td>
<td><input type="text" name="YMLP2" size="20"></td>
</tr>
<tr>
<td>Where did you first hear about Rebbeca?:</td>
<td><input type="text" name="YMLP3" size="20"></td>
</tr>
<tr>
<td>Favourite Song?:</td>
<td><input type="text" name="YMLP4" size="20"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Submit"></td>
</tr>
</table>
</form>
Sorry for my ignorance but what do you mean by an echo?
-
nope, no e-mail is received either.
-
Hi,
I'm making a site and I have a form on the site that when filled out and people click submit should allow them to download a file. The idea is that once the submit button is pressed a box will open to ask the user where they want to save the file to from the browser as usual with any file save when downloading from a site.
It is, however, not working. When the form is filled out and I press submit nothing happens but the form is cleared.
The php I have is as follows:
<?
$errors = 0;
$ref = $_SERVER['HTTP_REFERER'];
$email = $_POST['YPML0'];
$mobile = $_POST['YPML1'];
$location = $_POST['YPML2'];
$wherehear = $_POST['YPML3'];
$favesong = $_POST['YPML4'];
// User entered email on form?
if(!$email || strlen($email = trim($email)) == 0){
$errors += 1;
}
// Checks to see if email address is of valid type
$regex = "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)*"
."@[a-z0-9-]+(\.[a-z0-9-]{1,})*"
."\.([a-z]{2,}){1}$";
if(!eregi($regex,$email)){
$errors += 1;
}
// User entered location?
if(!$location || strlen($location = trim($location)) == 0){
$errors += 1;
}
// User entered where they heard about rebbeca?
if(!$wherehear || strlen($wherehear = trim($wherehear)) == 0){
$errors += 1;
}
// User entered their fave song?
if(!$favesong || strlen($favesong = trim($favesong)) == 0){
$errors += 1;
}
// If any errors were returned go back to the form
if ($errors > 0) {
header("location: ".$ref);
exit();
}
// Construct email
$to = "info@rebbeca.info";
$from = "From: Rebbeca <album@rebbeca.info>\n";
$subject = "Album Downloaded!";
$body = "E-mail address: ".$_POST['YPML0']."\n";
if ($_POST['YPML1']) {
$body .= "Mobile number: ".$_POST['YPML1']."\n";
}
$body .= "Location (city / country): ".$_POST['YPML2']."\n";
$body .= "First heard about Rebbeca: ".$_POST['YPML3']."\n";
$body .= "Favourite Song: ".$_POST['YPML4']."\n";
// Send it
mail($to,$subject,$body,$from);
// Commence download
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="musicbynumbers.zip"');
@readfile("http://www.rebbeca.info/music-by-numbers/musicbynumbers.zip");
?>
So the question is, what have I done wrong?
The html tag on the form that points to the php code is as follows: <form method="post" action="dlalbum.php">
Please note if anyone goes to the site and downloads what is uploaded it is currently a zip file of a ryan adams song and nothing to do with what the real file will be.
Thanks in advance for any help.
help please
in PHP Coding Help
Posted
now it's saying :
0http://rebbeca.info/newsite/pages/csssite/album.php
Warning: Cannot modify header information - headers already sent by (output started at \\filer01\soho\rebbeca.info\www.rebbeca.info\web\content\newsite\pages\csssite\dlalbum.php:11) in \\filer01\soho\rebbeca.info\www.rebbeca.info\web\content\newsite\pages\csssite\dlalbum.php on line 45
It seems that my line error just keeps increasing by 1!
If I give someone the server codes and let them test it themselves how much would it cost to get someone to do it all?