Code: Select all
<?php require_once('Connections/conn_ruplaying.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO covpics (Name, AGE, PICLINK) VALUES (%s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['Name'], "text"),
GetSQLValueString($HTTP_POST_VARS['AGE'], "int"),
GetSQLValueString($HTTP_POST_VARS['uploadFile'],"text")); mysql_select_db($database_conn_ruplaying, $conn_ruplaying); $Result1
= mysql_query($insertSQL, $conn_ruplaying) or die(mysql_error()); $insertGoTo
="uploadsuccess.htm"; if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { $insertGoTo
.= (strpos($insertGoTo, '?')) ?"&":"?"; $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
} header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_conn_ruplaying,
$conn_ruplaying);
$query_Recordset1 ="SELECT * FROM covpics"; $Recordset1 = mysql_query($query_Recordset1,
$conn_ruplaying) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="form1">
<p>Name:
<input name="Name" type="text" id="Name" value="">
</p>
<p>AGE:
<input name="AGE" type="text" id="AGE" value="">
</p>
<p>
<?
// start of dynamic form
$uploadNeed = "1"
?>
Picture:
<input name="uploadFile<? echo ?>" type="file" id="uploadFile<? echo ?>">
</p>
<p>
<input name="uploadNeed" type="hidden" value="<? echo $uploadNeed;?>">
</p>
<p>
<input type="hidden" name="MM_insert" value="form1">
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>feyd use
Code: Select all
tags next time.[/color]