Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6774363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:46:41+00:00 2026-05-26T15:46:41+00:00

On my site users fill out a form to register, this info then gets

  • 0

On my site users fill out a form to register, this info then gets added to a database. I’m trying to get the info to be written to a CSV file also. The code I have so far gives me this error:

Warning: fopen() [function.fopen]: Filename cannot be empty in /home/content/m/a/t/matronryan/html/sendmail3.php on line 122

Line 122: $fp = fopen($filename, “w”);

I can’t work out what the problem is. Here’s the code:

$first_name = $_POST['first_name']; // required
$last_name = $_POST['last_name']; // required
$email_from = $_POST['email']; // required
$stilldonate = $_POST['stilldonate']; // not required
$phone = $_POST['phone'];
$bid = $_POST['bid']; // required
$item = $_POST['item'];
$address1 = $_POST['address1']; // required
$address2 = $_POST['address2']; 
$city = $_POST['city'];
$county = $_POST['county']; // required
$postcode = $_POST['postcode']; // required
$updated = $_POST['updated']; 

include('db_functions.php');
    connect_to_db();
    $query="insert into auctionusers (firstname, lastname, address1, address2, city, county, postcode, email, phone, bid, stilldonate, item, updated) values ('$first_name', '$last_name', '$address1', '$address2', '$city', '$county', '$postcode', '$email_from', '$phone', '$bid', '$stilldonate', '$item', '$updated')";
    $result=mysql_query($query);


$filename == 'auctionusers.csv';
$fp = fopen($filename, "w");

$res = mysql_query("SELECT * FROM auctionusers");

// fetch a row and write the column names out to the file
$row = mysql_fetch_assoc($res);
$line = "";
$comma = "";
foreach($row as $name => $value) {
    $line .= $comma . '"' . str_replace('"', '""', $name) . '"';
    $comma = ",";
}
$line .= "\n";
fputs($fp, $line);

// remove the result pointer back to the start
mysql_data_seek($res, 0);

// and loop through the actual data
while($row = mysql_fetch_assoc($res)) {

    $line = "";
    $comma = "";
    foreach($row as $value) {
        $line .= $comma . '"' . str_replace('"', '""', $value) . '"';
        $comma = ",";
    }
    $line .= "\n";
    fputs($fp, $line);

}

fclose($fp);

mysql_close();


header('location: index2.php?op=Thank You&id=bid');

}
?>

Can Anyone see whats wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:46:42+00:00Added an answer on May 26, 2026 at 3:46 pm

    Change:

    $filename == 'auctionusers.csv';
    

    To:

    $filename = 'auctionusers.csv';
    

    Double equal performs a boolean operation upon the variable. You must’ve added an extra equals sign by mistake.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On my site, I have a form that users fill out to become a
I have a big form on my site. When the users fill it out
I have a form where my users can register to my site. They fill
In my Drupal 7 site, users will fill a form. After some search i
I have users fill out their profile information somewhere on my site using the
I want that users must fill out a form after the first login. With
I have a fairly simple website where users can fill out a form describing
I'm maintaining an ASP.NET site where users can log on to register some set
I have a website with a database of users. On the site, I ask
After my users register the first time, I want them to have to fill

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.