seany123 Posted October 29, 2009 Share Posted October 29, 2009 i have this code: <?php include('templates/header.php'); require('connect.php'); $albumid = $_GET['album']; echo $albumid; ?> <html> <table cellpadding='7' width='100%'> <tr> <td> <form action='upload.php' method='POST' enctype='multipart/form-data'> <input type='file' name='myfile'><p> <input type='submit' name='submit' value='upload'> <input type='text' name='album2' value='<?php.$albumid?>'> </form> </td> </tr> </table> </html> <?php //properties of the uploaded file. $name = $_FILES["myfile"]["name"]; $type = $_FILES["myfile"]["type"]; $size = $_FILES["myfile"]["size"]; $temp = $_FILES["myfile"]["tmp_name"]; $error = $_FILES["myfile"]["error"]; $id = $_SESSION['id']; //Display album name. $album = mysql_query("SELECT name FROM albums WHERE id='$albumid'"); $albumarray = mysql_fetch_assoc($album); if ($_POST['submit']) { if ($error > 0 ) die("<font size='4' face='arial'>There has been an error uploading your file, please try again!</font>"); else { if($size > 2500000) //conditions for file! die("<font size='4' face='arial'>That file is too big!</font>"); else { $id = $_SESSION['id']; $users = mysql_query("SELECT * FROM members WHERE id='$id'"); $row = mysql_fetch_assoc($users); $album2 = $_POST['album']; $userid = $row['id']; move_uploaded_file($temp,"store/".$name); $create = mysql_query("INSERT INTO items VALUES ('', '$userid', '$album2', 'i', '$name', '', '$name')"); echo "Uploaded Complete!!!"; echo "HERE: ".$_POST['album2']."".$_GET['album'].""; } } } include('templates/footer.php'); ?> when testing this code i use the url: http://localhost/visualupload/upload.php?album=6 im trying to make it so $albumid = $_GET['album']; and it works because it echo's 6... but as soon as i hit the submit button... it stops working. Quote Link to comment Share on other sites More sharing options...
chwebdesigns Posted October 29, 2009 Share Posted October 29, 2009 Where you have the code <form action='upload.php' you need to specify the album id again. So it will be something like <form action='upload.php?album=$albumid' method='post' Hope this helps Cal Quote Link to comment Share on other sites More sharing options...
Mchl Posted October 29, 2009 Share Posted October 29, 2009 <?php.$albumid?> This is not valid PHP. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.