hi everyone,

I am trying to make 5 pages.. 1 is an html page and the last 3 are php pages..

the html page is called data_uploader.htm and contains:

upload image
upload html AD
submit
go to sender

When you up click submit loads the files and then it returns to the data_uploader.htm page

when you click "go to sender", it opens a page called info_sender.php and contains:

pick a banner image (dropdown menu)
pick a banner ad (dropdown menu)
enter a custom message to inclide (textarea box)
enter email address
enter sunject
send
view

when you click view it opens a page called view.php and contains:

Email is going to:_______
banner image apperas here
banner ad appears here
custom message appears here

when you click send it opens a page called sender.php and contains:
this file sends the email and it should look like it does in view.php


my code looks like this...

here is my coding for it:

HTML:

Code:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" media="all" href="style.css" />
<title>Chip Upload Demo</title>
</head>

<body>

<div id="wrap">
  <div id="wrapdata">
    
    
    <div id="header">
      <div id="headerdata">      
        
        <div class="stylish style">
          <div class="stylishdata">          
            <h2 class="margin0">File Upload</h2>
          </div>
        </div>
        
            
      </div>
    </div>
    
    <div id="content">
      <div id="contentdata">
        
               
        <div class="stylish style">
          <div class="stylishdata">          
              <form method="post" action="uploader.php" enctype="multipart/form-data">
                <p>Upload File 1: <input name="upload_file[]" id="upload_file[]" type="file" class="inputtext" /></p> 
                <p>Upload File 2: <input name="upload_file[]" id="upload_file[]" type="file" class="inputtext" /></p>
                <input type="submit" name="submit" value="Submit" /> </form>
				<form action="info_sender.php" method="post" enctype="multipart/form-data">
				Enter Email Adress: <input name="address" type="text"> 
				<input type="submit" name="add" value="Add" /> <br />
				<input type="submit" name="em" value="go to sender" />
				
				</form>				
          </div>
        </div>
        
      </div>
    </div>
    
     
</div>


</body>
</html>

PHP where you click go to sender

PHP Code:
<?php
$filename = "addresses.txt";
$email = $_POST['address'] . "\n";

$ch = true;


if(isset($_POST['add']) && ($_POST['add'] == "Add"))
{
    if(file_exists($filename))
    {
        $file = fopen($filename, 'a');
        fwrite($file, $email);
        fclose($file);
    }
    else
    {
        $file = fopen($filename, 'w');

        if($file)
        {
            chmod($filename, 0777);
            fwrite($file, $email);
            fclose($file);
        }
    }

}

if(isset($_POST['disp']) && ($_POST['disp'] == "display"))
{
    $f = file($filename);


}

if(isset($_POST['em']) && ($_POST['em'] == "go to sender"))
{

    $f = file($filename);

    echo "<div>";
    echo "<form action='info_sender.php' method='post'>";
    echo "<label>Select Email: </label><select name='emails'>";

    foreach($f as $e)
    {
        echo "<option value='$e'>$e</option>";
    }

    echo "</select>";

    echo "<br /><label class='a'>Subject:</label> <input type='text' name='subj' method='post' />";
    echo "<br />";
    echo "<label class='a'>Message:</label> <textarea name='msg' cols='20' rows='10'></textarea>";
    echo "<p><input type='submit' name='sb' value='Send' /></p>";
    echo "</form>";
    echo "<div>";

}


?>

<?php if($ch) {

?>


<?php
}

if(!empty($f) && $ch)
{
    echo "All entered emails are listed below:<br />";
    foreach($f as $addr)
    {
        echo $addr . "<br />";
    }

}

?>

<?php


$recipient = $_POST['emails'];
$subject = $_POST['subj'];
$body = stripslashes($_POST['msg']);
$headers = 'From: someone@somewhere.net' . "\r\n";


//mail function

if(mail($recipient, $subject, $body, $headers, $from))
{

header('location: info_sender.php'); // go back to emails.php page
print ("thank you");
}

?>

this page shows the dropdown menu that displays the email to select, message box, subject and title... I would like for two more dropdown menus for the html file and html AD file.. The help is appreciated!

PHP Code that uploads the files:

<?php
/*
|-----------------
| POST
|------------------
*/

if( $_POST ) {
    
    /*
    |-----------------
    | Chip Upload Class
    |------------------
    */
    
    require_once("class.uploader.php");
    
    /*
    |-----------------
    | Upload(s) Directory
    |------------------
    */
    
    $upload_directory = "uploads";
    
    /*
    |-----------------
    | Class Instance
    |------------------
    */
    
    $object = new chip_upload();
    
    /*
    |-----------------
    | $_FILES Manipulation
    |------------------
    */
    
    $files = $object->get_upload_var( $_FILES['upload_file'] );
    //$object->chip_print( $files );
    
    /*
    |-----------------
    | Upload File
    |------------------
    */
    
    foreach( $files as $file ) {
    
        /*
        |---------------------------
        | Upload Inputs
        |---------------------------
        */
        
        $args = array(
              'upload_file'            =>    $file,
              'upload_directory'    =>    $upload_directory,
              'allowed_size'        =>    512000,
              'extension_check'        =>    TRUE,
              'upload_overwrite'    =>    FALSE,
          );
          
        $allowed_extensions = array(
            'pdf'    => FALSE,
        );
        
        /*
        |---------------------------
        | Upload Hook
        |---------------------------
        */        
        
        $upload_hook = $object->get_upload( $args, $allowed_extensions );        
        //$object->chip_print( $upload_hook );
        //exit;
        
        /*
        |---------------------------
        | Move File
        |---------------------------
        */
        
        if( $upload_hook['upload_move'] == TRUE ) {
            
            /*
            |---------------------------
            | Any Logic by User
            |---------------------------
            */
            
            /*
            |---------------------------
            | Move File
            |---------------------------
            */
            
            $upload_output[] = $object->get_upload_move();
            //$object->chip_print( $upload_output );
        
        } else {
        
            /*$temp['uploaded_status'] = FALSE;
            $temp['uploaded_file'] = $upload_hook['upload_file']['name'] ;
            
            $upload_output[] = $temp;*/
        
        }
        
    
    } // foreach( $files as $file )
    

} // if( $_POST )

?>
<?php if( !empty($upload_output) ): ?>
        <?php
        //$object->chip_print( $upload_output );
        foreach( $upload_output as $val ):
        ?>
        <div class="chipboxw1 chipstyle2">
          <div class="chipboxw1data">          
            <h2 class="margin0"><?php echo $val['uploaded_file'] . "." . $val['uploaded_extension'] . " Uploaded"; ?></h2>
          </div>
        </div>
        <?php endforeach; ?>
        <?php endif; ?>

the help would be greatly appreciated! its been driving me up the wall! :(

Member Avatar for jmichae3

you are missing a <!DOCTYPE...> to make this proper xhtml.
I have to go now.

Member Avatar for jmichae3

I don't see any menu code anywhere. what menu are you talking about? if you want to use e DHTML menu, you can get one from dynamicdrive.com or use the one in dreamweaver that is a spry widget or one of the other dreamweaver widgets.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.