URL Values going missing
Posted: Wed Apr 02, 2008 9:16 am
The code below has values passed via the URL from another page.
audio_insertDEV.php?product_ID=30
But when the conditional statement returns an empty field error (if the forms field is left blank etc) the URL looses it’s parameters and ends up just being:
audio_insertDEV.php
I’m not sure what to do here. Is it just the way I have the code running or is there something more I need to add?
Thanks
audio_insertDEV.php?product_ID=30
But when the conditional statement returns an empty field error (if the forms field is left blank etc) the URL looses it’s parameters and ends up just being:
audio_insertDEV.php
I’m not sure what to do here. Is it just the way I have the code running or is there something more I need to add?
Thanks
Code: Select all
<?php $colname_GetAudioUpdate = "1";
if (isset($_GET['product_ID'])) {
$colname_GetAudioUpdate = (get_magic_quotes_gpc()) ? $_GET['product_ID'] : addslashes($_GET['product_ID']);
}
mysql_select_db($database_******, $*****);
$query_GetAudioUpdate = sprintf("SELECT * FROM tbl_products WHERE product_ID = %s", $colname_GetAudioUpdate);
$GetAudioUpdate = mysql_query($query_GetAudioUpdate, $armstrong) or die(mysql_error());
$row_GetAudioUpdate = mysql_fetch_assoc($GetAudioUpdate);
$totalRows_GetAudioUpdate = mysql_num_rows($GetAudioUpdate);
$nomessage = '';
if ($_POST && array_key_exists('MM_update',$_POST)) {
//test to see it contains a MP3
if ($_FILES['fupload']['type'] == "audio/mpeg") {
} else {
$nomessage = '<br>'.'<span class="erroradmin"><strong>Opps! You must fill out the field and <br>make sure it\'s an MP3 you\'re uploading.</strong></span>';
}
if (!$nomessage ) {
// upload file
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
//insert into database
}}
?>Code: Select all
<form enctype="multipart/form-data" action="<?php print $_SERVER['PHP_SELF']?>" method="post">
Upload MP3 File: <?php if (isset($nomessage) && !empty($nomessage)) { echo $nomessage ; } ?>
<input type="file" name="fupload" value="<?php if (isset($_POST['fupload'])) echo $_POST['fupload'];?>"></td>
<input type= "hidden" name="MAX_FILE_SIZE" value="102400"/>
<input type= "submit" class="formButton" value="Upload MP3"/>
<input type="hidden" name="product_ID" value="<?php echo $row_GetAudioUpdate['product_ID']; ?>">
<input type="hidden" name="MM_update" value="form1">
</form>