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 6793829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:08:52+00:00 2026-05-26T18:08:52+00:00

Here is the site. I have the submit page, and a form action to

  • 0

Here is the site.

I have the submit page, and a form action to a page that queries the submission info into my database. I’ll include that code below. What I want to do, is have it create an individual page for each submission. However, I’m getting tons of errors when I try to upload. It uploads but it definitely doesn’t create new page. the I have a template form which I’ll show you, but first, here’s the upload page:

<?php
// For use in creating individual page
$tpl_file = "submission.php";
$tpl_path = "/~lyons/templates/";
$submissions_path = "/~lyons/submissions";


// For use in querying submitter name

$username = $_GET['username'];
session_start();
$_SESSION['username'] = $username; 

//Database Information

$dbhost = "";
$dbname = "";
$dbuser = "";
$dbpass = "";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());


$name = $_POST['name'];
$filename = $_POST['filename'];   
$submitter = $username;
list($width, $height) = getimagesize("$filename");
$type = exif_imagetype($_POST['filename']);

$checkuser = mysql_query("SELECT filename FROM images WHERE filename='$filename'");

$filename_exist = mysql_num_rows($checkuser);

if($filename_exist > 0){
    echo "I'm sorry but this image has already been submitted. Please feel free to try another.";
    unset($filename);
    include 'upload.php';
    exit();
}


if (exif_imagetype($_POST['filename']) == IMAGETYPE_GIF) {
    echo "Sorry, but we can't accept GIFs. Please feel free to try uploading another.";
    unset($filename);
    include 'upload.php';
    exit();
}



$query = "INSERT INTO images (name, filename, submitter, width, height, type)
VALUES('$name', '$filename', '$submitter', '$width', '$height', $type)";
mysql_query($query) or die(mysql_error());
mysql_close();

echo "Thanks for your submission!<br/> Upload another <a href='/~lyons/upload.php'>here</a>!";

$placeholders = array("{name}", "{filename}", "{username}");
$tpl = file_get_contents($tpl_path.$tpl_file);
$new_member_file = str_replace($placeholders, $data, $tpl);
$php_file_name = $username.".php";

$fp = fopen($submissions_path.$php_file_name, "w");
fwrite($fp, $new_submission_file);
fclose($fp); 
?>

And here’s the template file (submission.php)

<html>
<title>{name}</title>
<head>
</head>

<body>
<h1>{name}</h1>
Posted by: {username}
<br/>
<img src="{filename}"/>

</body>
</html>
  • 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-26T18:08:53+00:00Added an answer on May 26, 2026 at 6:08 pm

    It looks like you might have a path issue. When you use the path “/~lyons” you may not be pointing to the directory you want. Try making the changes below:

    // For use in creating individual page
    $tpl_file = "submission.php";
    //$tpl_path = "/~lyons/templates/";
    $tpl_path = "templates/";
    

    And then please post the new error message(s), if any.

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

Sidebar

Related Questions

I have a form that i am trying to submit after the page loads
Here is my issue. I have an ASPX web site and I have code
Here's the scenario: I have a private site that, once logged on, will display
I have a form on my page that I am having trouble receiving a
I have a page with a form like so: <form method=POST action=scripts/save-settings2.php> <div id=posts>
I have a site showing lots of products here When you click on the
Here's the setup. I have web site which is essentially a simple CMS. Here
I have a site thats served in 2 flavours, English and French. Here's some
I have been following the affableBean tutorial from the NetBeans site located here .
Hey everyone, here is the site in question: http://www.myvintagesecret.com/ I have a bunch of

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.