Jump to content

$_GET isnt working!!


seany123

Recommended Posts

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.