logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > General
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 09-29-2007, 04:27 AM   #1
m1a2x3x7
m1a2x3x7's Avatar
 
Join Date: Mar 2007
Posts: 297
Default validation issue

When i create my validation script i have a slight problem. once you submit the form it clears all the boxes so the stuff they did fill out is empty with no red * and the stuff they didnt fill out is with a red * how can i keep the information that they did fill out in the boxes if they submit with out completion?

my code

PHP Code:
<?php
 
ob_start
();
require_once(
"../connection.php");
session_start();
 
 
$artist $_POST['artist'];
$targetPath $artist;
$targetPathSm$artist;
$targetPath $targetPath basename$_FILES['LGupload']['name']);
$targetPathSm $targetPathSm basename$_FILES['SMupload']['name']);
$error "*";
 
 
 
 
 
if (isset(
$_POST['submit']) && ($_POST['artist']) && ($_FILES['LGupload']['name']) && ($_POST['imageW']) && ($_POST['imageH']) && ($_FILES['SMupload']['name']) && ($_POST['title']) && ($_POST['description']) && ($_POST['artSize']) && ($_POST['price'])) {
 
$query =sprintf("INSERT INTO art (artist, lg_picture, lg_width, lg_height, sm_picture, title, description, art_size, price) VALUES ('{$_POST['artist']}', '{$_FILES['LGupload']['name']}', '{$_POST['imageW']}','{$_POST['imageH']}', '{$_FILES['SMupload']['name']}', '{$_POST['title']}', '{$_POST['description']}', '{$_POST['artSize']}', '{$_POST['price']}')"); 
$result = @mysql_query($query);
 
move_uploaded_file($_FILES['LGupload']['tmp_name'], $targetPath);
move_uploaded_file($_FILES['SMupload']['tmp_name'], $targetPathSm); 
}
?>
 
<form enctype="multipart/form-data" action="<?php $_SERVER['PHP_SELF'];?>" method="post">
<table width="776" border="0">
<tr>
<td width="100" align="right" valign="top"><div align="right"><span class="style3">Artist | </span></div></td>
<td width="619" class="style3"><select name="artist" class="style3" id="artist">
<option value="mcfee/" selected="selected">Mcfee</option>
<option value="allen/">Allen</option>
<option value="olga/">Olga</option>
<option value="athomas/">Athomas</option>
<option value="craig/">Craig</option>
</select></td>
</tr>
<tr>
<td width="100" align="right" valign="top"><div align="right"><span class="style3">
<?php 
if (isset($_POST['submit'])) {
 
if (!(
strlen($_FILES['LGupload']['name']) > )){
?> <font color="#FF0000"> 
<?php echo $error;
}}
?> </font>Large Image | </span></div></td>
<td width="619" class="style3"><input type="hidden" name="MAX_FILE_SIZE2" value="524288" />
<input name="LGupload" type="file" class="style3" /></td>
</tr>
<tr>
<td width="100" align="right" valign="top"><div align="right"><span class="style3">
<?php 
if (isset($_POST['submit'])) {
 
if (!(
strlen($_POST['imageW']) > )){
?> <font color="#FF0000"> 
<?php echo $error;
}}
?> </font> Image Width | </span></div></td>
<td width="619" class="style3"><input name="imageW" type="text" class="style3" id="imageW" /></td>
</tr>
<tr>
<td width="100" align="right" valign="top"><div align="right"><span class="style3">
<?php 
if (isset($_POST['submit'])) {
 
if (!(
strlen($_POST['imageH']) > )){
?> <font color="#FF0000"> 
<?php echo $error;
}}
?> </font>Image Height | </span></div></td>
<td width="619" class="style3"><input name="imageH" type="text" class="style3" id="imageH" /></td>
</tr>
<tr>
<td width="100" align="right" valign="top"><div align="right"><span class="style3">
<?php 
if (isset($_POST['submit'])) {
 
if (!(
strlen($_POST['title']) > )){
?> <font color="#FF0000"> 
<?php echo $error;
}}
?> </font>Title | </span></div></td>
<td width="619" class="style3"><input name="title" type="text" class="style3" id="title" /></td>
</tr>
<tr>
<td width="100" align="right" valign="top"><div align="right"><span class="style3"> 
<?php 
if (isset($_POST['submit'])) {
 
if (!(
strlen($_POST['description']) > )){
?> <font color="#FF0000"> 
<?php echo $error;
}}
?> </font>Description | </span></div></td>
<td width="619" class="style3"><textarea name="description" class="style3" id="description"></textarea></td>
</tr>
<tr>
<td width="100" align="right" valign="top"><div align="right"><span class="style3">
<?php 
if (isset($_POST['submit'])) {
 
if (!(
strlen($_FILES['SMupload']['name']) > )){
?> <font color="#FF0000"> 
<?php echo $error;
}}
?> </font>Thumbnail |</span></div></td>
<td width="619" class="style3"><input type="hidden" name="MAX_FILE_SIZE" value="524288" />
<input name="SMupload" type="file" class="style3" />
Image must be 100x100px </td>
</tr>
<tr>
<td width="100" align="right" valign="top"><div align="right"><span class="style3">
<?php 
if (isset($_POST['submit'])) {
 
if (!(
strlen($_POST['artSize']) > )){
?> <font color="#FF0000"> 
<?php echo $error;
}}
?> </font>Art Size | </span></div></td>
<td width="619" class="style3"><input name="artSize" type="text" class="style3" id="artSize" /></td>
</tr>
<tr>
<td width="100" align="right" valign="top"><div align="right"><span class="style3">
<?php 
if (isset($_POST['submit'])) {
 
if (!(
strlen($_POST['price']) > )){
?> <font color="#FF0000"> 
<?php echo $error;
}}
?> </font>Price | </span></div></td>
<td width="619" class="style3"><input name="price" type="text" class="style3" id="price" /></td>
</tr>
<tr>
<td width="100"><div align="right"></div></td>
<td width="619" class="style3"><div align="right">
 
 
<div align="right">
<input name="hiddenField" type="hidden" value="1" />
<input name="submit" type="submit" class="style3" value="Submit" />
</div></td>
</tr>
</table>
 
 
 
</form>
Thanks for the help.

-M
m1a2x3x7 is offline   Reply With Quote
Old 09-29-2007, 04:41 AM   #2
m1a2x3x7
m1a2x3x7's Avatar
 
Join Date: Mar 2007
Posts: 297
Default

nevermind...2 sunkists later it finally came to me WoOT!
m1a2x3x7 is offline   Reply With Quote
Old 09-29-2007, 09:40 AM   #3
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

m1

please use your code formating tags when posting
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:37 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com