Jump to content

bpburrow

Members
  • Posts

    45
  • Joined

  • Last visited

    Never

Everything posted by bpburrow

  1. If anyone's interested I had to add a value to the button tag. Don't know why, didn't think it was necessary considering the format I was using. Here's my new button: <button class="primary_lg right" title="Sign in" type="submit" name="submit" value="Sign in">Sign in</button>
  2. Need help figuring out why my button tag isn't working. If I use the standard input tag, <input type="submit" name="submit" value="Sign in" />, I have no issues. However, I want to use <button type="submit" name="submit" class="primary_lg right">Sign in</button> to dress it up a bit. Problem is, even though variables are being passed, it doesn't pull up my main admin page. In short, I want this which doesn't work: <button type="submit" name="submit" class="primary_lg right">Sign in</button> instead of this which does work: <input type="submit" name="submit" value="Sign in" /> Both pass variables, however the <button> doesn't load the follow-on page (mainadmin.php). Here's my script: <?php if(!$_POST['submit']){ // 'submit' hasn't been clicked so output html.?> <form action="admin_login2.php" method="post"> <fieldset> <div style="float:right;"><a href="/SSP/ssp_director/index.php?/users/password" title="Click here to retrieve login" class="mute">Lost username?</a></div> <label for="username">Username:</label> <input id="username" type="text" name="username" class="wide" value="" /> </fieldset> <fieldset> <label for="password">Password:</label> <input type="password" name="password" class="wide" value="" /> </fieldset> <fieldset> <button type="submit" name="submit" class="primary_lg right">Sign in</button> <input type="submit" name="submit" value="Sign in" /> </fieldset> </form> <?php }else{ $user= protect($_POST['username']); $pass= protect($_POST['password']); if($user && $pass){ $pass = md5($pass); //compare the encrypted password $sql="SELECT id,username FROM Admin WHERE username='$user' AND password='$pass'"; $query=mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($query) > 0){ $row = mysql_fetch_assoc($query); // mysql_fetch_assoc gets the value for each field in the row $_SESSION['id'] = $row['id']; //creates the first session var $_SESSION['username'] = $row['username']; // second session var echo "<script type=\"text/javascript\">window.location=\"mainadmin.php\"</script>"; }else{ //I added $user, $pass to see the forms output. Output was same as db. echo "<script type=\"text/javascript\"> alert(\"Username and password combination is incorrect!\"); window.location=\"admin_login2.php\"</script>"; } }else{ //this script works fine when I leave a field empty echo "<script type=\"text/javascript\"> alert(\"You need to gimme a username AND password!\"); window.location=\"admin_login2.php\"</script>"; } } ?>
  3. Last month I was crawling. Today I feel like I'm standing. Thanks for the help. Makes a lot of sense!! I had to change <?php $folder=mysql_result($res, 0, 0); $image=mysql_result($res, 1, 0); ?> with <?php $folder=mysql_result($res, 0, "foldername"); $image=mysql_result($res, 0, "image_name"); ?> Everything seems to be working fine. I'll close this post once I'm sure all the bugs have been worked out. Thanks again!! Here's the script if anyone's interested. <?php // If 'delbtn' clicked then delete row, folder and image then show new slideshow listing. if(isset($_POST['delbtn'])){ // Loop through check boxes foreach($_POST['deletes'] as $id){ $res = mysql_query("SELECT foldername, image_name FROM Slideshow WHERE slide_id='$id'"); $folder=mysql_result($res, 0, "foldername"); $image=mysql_result($res, 0, "image_name"); $folderPath = implode(DIRECTORY_SEPARATOR, array('..','client', $folder)); $imagePath = implode(DIRECTORY_SEPARATOR, array('..','client_images', $image)); // Delete folder and contents. if (!is_dir($folderPath)) { echo 'Folder path does not exist. '; }else{ rmdir($folderPath) or die( "Unable To Delete Folder. Please Try Again Later" ); } // Delete client image. if(!is_file($imagePath)){ echo 'Client image path does not exist'; }else{ unlink($imagePath) or die( "Unable To Delete File. Please Try Again Later" ); } // Delete row from database mysql_query("DELETE FROM Slideshow WHERE slide_id='$id'"); } } // SQL query $query="SELECT * FROM Slideshow"; $result=mysql_query($query) or die('Query failed: ' . mysql_error()); // Get number of rows $num_rows = mysql_num_rows($result); // Error message for empty DB else show results if ($num_rows == 0){ $errors[] = "Database does not contain slideshow listings!<br /><br /> <button type=\"submit\" onClick=\"location.href='slideshow_new.php'\">Add Slideshow</button>"; } else { ?> <form action="slideshow_list.php" method="post" class="clearfix"> <fieldset class="clearfix"> <legend> Slideshow List </legend> <?php // Print results in HTML // Number of records echo "<p class=\"indent\">Slideshow count = $num_rows</p>\n"; ?> <table border="0" cellpadding="4" cellspacing="4" align="center"> <tr> <th align=center>Delete</th> <th>ID</th> <th>Username</th> <th>Folder</th> <th>Active</th> <th>Date</th> <th>Image</th> </tr> <?php while($row=mysql_fetch_array($result)){?> <tr> <td align=center><input type="checkbox" name= <?php echo "deletes[]" ?> id= <?php echo $row['slide_id'] ?> value=<?php echo $row['slide_id'] ?> /></td> <td><?php echo $row['slide_id'] ?></td> <td><?php echo $row['username'] ?></td> <td><?php echo $row['foldername'] ?></td> <td align="center"><?php echo $row['active'] ?></td> <td><?php echo $row['session_date'] ?></td> <td><?php echo $row['image_name'] ?></td> </tr> <?php } ?> <tr> <td><input class="delete" type="submit" name="delbtn" value="Delete" /></td> </tr> </table> </fieldset> </form> <?php } if(count($errors) > 0){ ?> <fieldset class="clearfix"> <legend>Errors</legend> <?php echo "<div class=\"indent\"><br /><p class=\"bodyText\">The following errors have occured:</p></div>"; echo "<div class=\"indent\"><p class=\"error\">"; foreach($errors AS $error){ echo $error . "\n"; } echo "</p></div>"; } //close DB mysql_close(); ?>
  4. I mispoke when I said I got nothing from echoing $folder and $image. What I'm getting is foldername and image_name. Hard coding is not my intent. I want to select 'foldername' and 'image_name' values from the db according to the selected id.
  5. This administrator page displays a list of client slideshows with a delete checkbox at the beginning of each row. Upon submission the script deletes the folder containing the slideshow, deletes an image in a different folder, and removes the record from the database; then it reloads itself showing the current listings. I'm having a problem deleting the folder and image. I think the problem is happening with the $folder and $image variable assignments. To test it I tried to echo $folder and $image and got nothing which would explain why I'm getting errors with paths not existing. I'm sure the answer's right there in front of me, I'm just not seeing it. Thanks in advance. <?php // If 'delbtn' clicked then delete row, folder and image then show new slideshow listing. if(isset($_POST['delbtn'])){ // Loop through check boxes foreach($_POST['deletes'] as $id){ mysql_query("SELECT FROM SLIDESHOW foldername, image_name WHERE slide_id='$id'"); $folder='foldername'; $image='image_name'; $folderPath = implode(DIRECTORY_SEPARATOR, array('..','client','$folder')); $imagePath = implode(DIRECTORY_SEPARATOR, array('..','client_images','$image')); echo $folder; echo $image_name; // Delete folder and contents. if (!is_dir('$folderPath')) { echo 'Folder $folder does not exist. '; }else{ rmdir("$folderPath") or die( "Unable To Delete Folder. Please Try Again Later" ); } // Delete client image. if(!is_file("$imagePath")){ echo 'Client image $image does not exist'; }else{ unlink("$image") or die( "Unable To Delete File. Please Try Again Later" ); } // Delete row from database mysql_query("DELETE FROM Slideshow WHERE slide_id='$id'"); } } // SQL query $query="SELECT * FROM Slideshow"; $result=mysql_query($query) or die('Query failed: ' . mysql_error()); // Get number of rows $num_rows = mysql_num_rows($result); // Error message for empty DB else show results if ($num_rows == 0){ $errors[] = "Database does not contain slideshow listings!<br /><br /> <button type=\"submit\" onClick=\"location.href='slideshow_new.php'\">Add Slideshow</button>"; } else { ?> [code] Here's the entire code if you're interested. [code] <?php // If 'delbtn' clicked then delete row, folder and image then show new slideshow listing. if(isset($_POST['delbtn'])){ // Loop through check boxes foreach($_POST['deletes'] as $id){ mysql_query("SELECT FROM SLIDESHOW foldername, image_name WHERE slide_id='$id'"); $folder='foldername'; $image='image_name'; $folderPath = implode(DIRECTORY_SEPARATOR, array('..','client','$folder')); $imagePath = implode(DIRECTORY_SEPARATOR, array('..','client_images','$image')); echo $folder; echo $image_name; // Delete folder and contents. if (!is_dir('$folderPath')) { echo 'Folder $folder does not exist. '; }else{ rmdir("$folderPath") or die( "Unable To Delete Folder. Please Try Again Later" ); } // Delete client image. if(!is_file("$imagePath")){ echo 'Client image $image does not exist'; }else{ unlink("$image") or die( "Unable To Delete File. Please Try Again Later" ); } // Delete row from database mysql_query("DELETE FROM Slideshow WHERE slide_id='$id'"); } } // SQL query $query="SELECT * FROM Slideshow"; $result=mysql_query($query) or die('Query failed: ' . mysql_error()); // Get number of rows $num_rows = mysql_num_rows($result); // Error message for empty DB else show results if ($num_rows == 0){ $errors[] = "Database does not contain slideshow listings!<br /><br /> <button type=\"submit\" onClick=\"location.href='slideshow_new.php'\">Add Slideshow</button>"; } else { ?> <form action="slideshow_list.php" method="post" class="clearfix"> <fieldset class="clearfix"> <legend> Slideshow List </legend> <?php // Print results in HTML // Number of records echo "<p class=\"indent\">Slideshow count = $num_rows</p>\n"; ?> <table border="0" cellpadding="4" cellspacing="4" align="center"> <tr> <th align=center>Delete</th> <th>ID</th> <th>Username</th> <th>Folder</th> <th>Active</th> <th>Date</th> <th>Image</th> </tr> <?php while($row=mysql_fetch_array($result)){?> <tr> <td align=center><input type="checkbox" name= <?php echo "deletes[]" ?> id= <?php echo $row['slide_id'] ?> value=<?php echo $row['slide_id'] ?> /></td> <td><?php echo $row['slide_id'] ?></td> <td><?php echo $row['username'] ?></td> <td><?php echo $row['foldername'] ?></td> <td align="center"><?php echo $row['active'] ?></td> <td><?php echo $row['session_date'] ?></td> <td><?php echo $row['image_name'] ?></td> </tr> <?php } ?> <tr> <td><input class="delete" type="submit" name="delbtn" value="Delete" /></td> </tr> </table> </fieldset> </form> <?php } if(count($errors) > 0){ ?> <fieldset class="clearfix"> <legend>Errors</legend> <?php echo "<div class=\"indent\"><br /><p class=\"bodyText\">The following errors have occured:</p></div>"; echo "<div class=\"indent\"><p class=\"error\">"; foreach($errors AS $error){ echo $error . "\n"; } echo "</p></div>"; //we use javascript to go back rather than reloading the page // so the user doesn't have to type in all that info again. } //close DB mysql_close(); ?>
  6. Here's a sight that's been helping me get started. http://www.free-css.com/free-css-resources.php
  7. I had a comment before " @charset "UTF-8" " in my CSS. Apparently that's a no no. It's interesting that firefox ignored the error.
  8. So I've spent the last year or so learning the basics of html, css, php and mysql while all along building a website. This week I decided to go back and clean up all patch work and various types of styles and methods. I created dummy pages while making changes just in case I screwed things up. It's a good thing I did. Apparently I didn't learn enough. Can anyone tell me why my css is working just fine in Firefox, but doesn't work at all in Safari or Chrome. www.brittanyburrowphotography.com/index2.php
  9. Because it's been a long day and I'm in desperate need of sleep. Your fix worked!! Thanks to all who helped. Here's the finished script if anyone wants to see: <div id="col3_content" class="clearfix"> <form action="client_list.php" action="slideshow_new.php" method="post" class="clearfix"> <fieldset class="clearfix"> <legend> Client List </legend> <?php // SQL query $query="SELECT * FROM Client"; $result=mysql_query($query) or die('Query failed: ' . mysql_error()); $num_rows = mysql_num_rows($result); // Error message for empty DB if ($num_rows == 0){ $errors[] = "Database contains no client records.<br /> <div class=\"bodyText\"><a href=\"../admin/client_new.php\">Add Client</a></div>"; } else { // Print results in HTML // Number of records $num_rows = mysql_num_rows($result); echo "<p class=\"indent\">Client count = $num_rows</p>\n"; ?> <table border="0" cellpadding="4" cellspacing="4" align="center"> <tr> <th align=center>Delete</th> <th>ID</th> <th>Firstname</th> <th>Lastname</th> <th>Username</th> <th>Email</th> </tr> <?php while($row=mysql_fetch_array($result)){ ?> <tr> <td align=center><input type="checkbox" name= <?php echo "deletes[]" ?> id= <?php echo $row['client_id'] ?> value=<?php echo $row['client_id'] ?> /></td> <td><?php echo $row['client_id'] ?></td> <td><?php echo $row['firstName'] ?></td> <td><?php echo $row['lastName'] ?></td> <td><?php echo $row['username'] ?></td> <td><?php echo $row['email'] ?></td> </tr> <?php } ?> <td><input class="delete" type="submit" name="delbtn" value="Delete" /></td> </table> <?php } ?> </fieldset> </form> <?php if(isset($_POST['delbtn'])) { // Loop through check boxes foreach($_POST['deletes'] as $id){ // Delete record from database mysql_query("DELETE FROM Client WHERE client_id='$id'"); } } if(count($errors) > 0){ echo "<fieldset><legend>Errors</legend>"; echo "<div class=\"indent\"><br /><p class=\"bodyText\">The following errors occured with your client:</p></div><br />"; echo "<div class=\"indent\"><p class=\"error\">"; foreach($errors AS $error){ echo $error . "\n"; } echo "</p></div>"; //we use javascript to go back rather than reloading the page // so the user doesn't have to type in all that info again. } //close DB mysql_close(); ?> </div>
  10. Well that's embarrasing. I fixed the contents problem. However, the page still isn't reloading on Delete. <table border="0" cellpadding="4" cellspacing="4" align="center"> <tr> <th align=center>Delete</th> <th>ID</th> <th>Firstname</th> <th>Lastname</th> <th>Username</th> <th>Email</th> </tr> <?php while($row=mysql_fetch_array($result)){ ?> <tr> <td align=center><input type="checkbox" name= <?php echo "deletes[]" ?> id= <?php echo $row['client_id'] ?> value=<?php echo $row['client_id'] ?> /></td> <td><?php echo $row['client_id'] ?></td> <td><?php echo $row['firstName'] ?></td> <td><?php echo $row['lastName'] ?></td> <td><?php echo $row['username'] ?></td> <td><?php echo $row['email'] ?></td> </tr> <?php } ?> <td><input class="delete" type="submit" name="delbtn" value="Delete" onclick="document.location = '../admin/client_list.php';"/></td> </table>
  11. I made the changes, however, the variables aren't passing info to the table. I'm guessing syntax errors. Here's the section of table having issues. <table border="0" cellpadding="4" cellspacing="4" align="center"> <tr> <th align=center>Delete</th> <th>ID</th> <th>Firstname</th> <th>Lastname</th> <th>Username</th> <th>Email</th> </tr> <?php while($row=mysql_fetch_array($result)){ ?> <tr> <td align=center><input type="checkbox" name= <?php "deletes[]" ?> id= <?php $row['client_id'] ?> value=<?php $row['client_id'] ?> /></td> <td><?php $row['client_id'] ?></td> <td><?php $row['firstName'] ?></td> <td><?php $row['lastName'] ?></td> <td><?php $row['username'] ?></td> <td><?php $row['email'] ?></td> </tr> <?php } ?> <tr> <td><input class="delete" type="submit" name="delbtn" value="Delete" onclick="document.location = '../admin/client_list.php';"/></td> </tr> </table>
  12. That's a pretty cool trick. Definately something I'll keep in my back pocket. The problem was in the mysql query. I had <?php mysql_query("DELETE FROM Client WHERE id='$id'");?> vice <?php mysql_query("DELETE FROM Client WHERE client_id='$id'"); ?> Next, how do I go about reloading the page without using header('Location: ../some.php/');? The header function seem to conflict with a number of included/required .php files. I thought about using JS onClick for the delete button but then the page would be redirected without completing the script to delete rows. Any suggestions??
  13. I didn't show entire script on last post. Here's what I have with recommended changes. Still having the same problem. <form action="client_list.php" method="post" class="clearfix"> <fieldset class="clearfix"> <legend> Client List </legend> <?php // SQL query $query="SELECT * FROM Client"; $result=mysql_query($query) or die('Query failed: ' . mysql_error()); $num_rows = mysql_num_rows($result); // Error message for empty DB if ($num_rows == 0){ $errors[] = "Database contains no client records.<br /> <div class=\"bodyText\"><a href=\"../admin/client_new.php\">Add Client</a></div>"; } else { // Print results in HTML // Number of records $num_rows = mysql_num_rows($result); echo "<p class=\"indent\">Client count = $num_rows</p>\n"; echo "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" align=\"center\"> <tr> <th align=center>Delete</th> <th>ID</th> <th>Firstname</th> <th>Lastname</th> <th>Username</th> <th>Email</th> </tr>\n"; while($row=mysql_fetch_array($result)) { echo "<tr>\n"; echo "\n<td align=center><input type=\"checkbox\" name=\"deletes[]\" id=\"". $row['client_id'] . "\" value=\"". $row['client_id'] . "\" /></td>"; echo "\n<td>". $row['client_id'] . "</td>"; echo "\n<td>". $row['firstName'] . "</td>"; echo "\n<td>". $row['lastName'] . "</td>"; echo "\n<td>". $row['username'] . "</td>"; echo "\n<td>". $row['email'] . "</td>"; echo "\n</tr>"; } echo "\n<td><input class=\"delete\" type=\"submit\" name=\"delbtn\" value=\"Delete\" /></td>"; echo "\n</table>\n"; } ?> </fieldset> </form> <?php if(isset($_POST['delbtn'])) { // Loop through check boxes foreach ($_POST['deletes'] as $id){ // Delete record from database mysql_query("DELETE FROM Client WHERE id='$id'"); } } if(count($errors) > 0){ echo "<fieldset><legend>Errors</legend>"; echo "<div class=\"indent\"><br /><p class=\"bodyText\">The following errors occured with your client:</p></div><br />"; echo "<div class=\"indent\"><p class=\"error\">"; foreach($errors AS $error){ echo $error . "\n"; } echo "</p></div>"; //we use javascript to go back rather than reloading the page // so the user doesn't have to type in all that info again. } //close DB mysql_close(); ?>
  14. I scrapped my previous table and decided to start over. How that the html formatting is out of the way I'm stuck on the delete action. Rows aren't being deleted after pressing button. <?php // SQL query $query="SELECT * FROM Client"; $result=mysql_query($query) or die('Query failed: ' . mysql_error()); $num_rows = mysql_num_rows($result); // Error message for empty DB if ($num_rows == 0){ $errors[] = "Database contains no client records.<br /> <div class=\"bodyText\"><a href=\"../admin/client_new.php\">Add Client</a></div>"; } else { // Print results in HTML // Number of records $num_rows = mysql_num_rows($result); echo "<p class=\"indent\">Client count = $num_rows</p>\n"; echo "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" align=\"center\"> <tr> <th align=center>Delete</th> <th>ID</th> <th>Firstname</th> <th>Lastname</th> <th>Username</th> <th>Email</th> </tr>\n"; while($row=mysql_fetch_array($result)) { echo "<tr>\n"; echo "\n<td align=center><input type=checkbox name=". $row['client_id'] . " id=". $row['client_id'] . " value=". $row['client_id'] . " /></td>"; echo "\n<td>". $row['client_id'] . "</td>"; echo "\n<td>". $row['firstName'] . "</td>"; echo "\n<td>". $row['lastName'] . "</td>"; echo "\n<td>". $row['username'] . "</td>"; echo "\n<td>". $row['email'] . "</td>"; echo "\n</tr>"; } echo "\n<td><input class=\"delete\" type=\"submit\" name=\"delbtn\" value=\"Delete\" /></td>"; echo "\n</table>\n"; } $id= $_POST["client_id"]; if(isset($_POST['delbtn'])) { // Loop through check boxes foreach($_POST as $id) { // Delete record from database mysql_query("DELETE FROM Client WHERE id='$id'"); } } if(count($errors) > 0){ echo "<div class='error'>"; foreach($errors AS $error){ echo $error . "<br />"; } echo "</div>"; echo "<div class=\"bodyText\"><a href=\"../admin/client_new.php\">Add Client</a></div>"; //we use javascript to go back rather than reloading the page // so the user doesn't have to type in all that info again. } //close DB mysql_close(); ?>
  15. The link appears after each field. How do I adjust so it only shows at the end of the rows? I added the following: <?php foreach ($line as $col_value){ echo "\t\t<td>$col_value<a href=\"delete.php\">Delete</a></td>\n"; } ?> And this is what I've got: Client count = 4 client_id firstName lastName username passwd email 10Delete janeDelete doeDelete test1Delete 5a105e8b9d40e1329780Delete test1@hotmail.comDelete
  16. I'll have to think about the password issue and come back to it later. As for the delete option, I've tried setting up a hyperlink for a delete.php. I'm running into formatting issues where the delete links line up in one row instead of at the end of each row.
  17. I think I'll do that. Any suggestions for a Delete option?
  18. So I've got this really great table that neatly displays client data. Problem is the password is displayed as stored using the md5 function. How do I go about decrypting the password? Second, I'd like to add a delete capability (button, check box or radio button) at the end of each row. Problem is this is outside the scope of my php know how. Is there a simple solution I can incorporate into my existing script or will it require a lot of restructuring? Here's how my table looks (I added Delete as part of this post): Client count = 4 client_id firstName lastName username passwd email 10 jane doe test1 5a105e8b9d40e1329780 test1@hotmail.com Delete // Would like to add delete button 11 jane doe test2 ad0234829205b9033196 test2@hotmail.com Delete 12 john doe test3 8ad8757baa8564dc136c test3@hotmail.com ......etc 13 john doe test4 86985e105f79b95d6bc9 test4@hotmail.com client_list.php <?php // SQL query $query="SELECT * FROM Client"; $result=mysql_query($query) or die('Query failed: ' . mysql_error()); $num_rows = mysql_num_rows($result); // Error message for empty DB if ($num_rows == 0){ $errors[] = "Database contains no client records."; } else { // Print results in HTML // Number of records $num_rows = mysql_num_rows($result); echo "<p class=\"indent\">Client count = $num_rows</p>\n"; // Set up table echo "<table border=\"0\" cellpadding=\"4\" cellspacing=\"0\" align=\"center\">\n"; $line = mysql_fetch_array($result, MYSQL_ASSOC); echo "\t<tr>\n"; // echo "\t\t<th>#</th>\n"; // Set title row for data foreach (array_keys($line) as $col_value){ echo "\t\t<th class=\"listTitle\">$col_value</th>\n"; } echo "\t</tr>\n"; //$i=0; do{ echo "\t<tr>\n"; //$i++; //echo "\t\t<th>$i</th>\n"; foreach ($line as $col_value){ echo "\t\t<td>$col_value</td>\n"; } echo "\t</tr>\n"; } while ($line = mysql_fetch_array($result, MYSQL_ASSOC)); echo "</table><br />"; } if(count($errors) > 0){ echo "<div class='error'>"; foreach($errors AS $error){ echo $error . "<br />"; } echo "</div>"; echo "<a href=\"../admin/client_new.php\">Add Client</a>"; //we use javascript to go back rather than reloading the page // so the user doesn't have to type in all that info again. } mysql_close(); ?>
  19. Thanks!! That did the trick. I guess my clean up wasn't so clean. As for the function, I know it's redundant. I use it because it's shorter than writing it the other way.
  20. <?php function protect($string)//function to prevent SQL injection { $string = mysql_real_escape_string($string); return $string; } ?> I had the form working until I went back to clean it up. Not sure where I went wrong. The protect() function is used throughout my site. I doubt that's where the problem lies.
  21. I've got this form to input client information into a db. One of my very first error controls is to determine if the form is complete. For some reason the error always come up as "You did not fill out the required fields." even when the form IS filled out properly. client_new.php <?php if(!$_POST['submit']) // 'submit' hasn't been clicked so output html. { ?> <form action="client_new.php" method="post" class"clearfix"> <fieldset class="clearfix"> <legend>New Client</legend> <ol> <li> <label for="firstname">First Name:</label> <input id="firstname" name"firstname" class="textfield_effect" type="text" /> </li> <li> <label for="lastname">Lastname:</label> <input id="lastname" name="lastname" class="textfield_effect" type="text" /> </li> <li> <label for="username">Username:</label> <input id="username" name="username" class="textfield_effect" type="text" /> </li> <li> <label for="password">Password:</label> <input id="passwd" name"passwd" class="textfield_effect" type="text" /> </li> <li> <label for="email">Email:</label> <input id="email" name="email" class="textfield_effect" type="text" /> </li> <input type="submit" name="submit" value="Add Client" /> </ol> </fieldset> </form> <?php } else { $firstname = protect($_POST['firstname']); $lastname = protect($_POST['lastname']); $username = protect($_POST['username']); $passwd = protect($_POST['passwd']); $email = protect($_POST['email']); if(!$firstname || !$lastname || !$username || !$passwd || !$email) { $errors[] = "You did not fill out the required fields. <br />"; } if (!ereg('^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$', $email)) { $errors[] = "Email was incomplete or unrecognized. <br />"; } $sql = "SELECT * FROM Client WHERE `username`='{$username}'"; $query = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($query) > 0) { $errors[] = "Username already taken, please try another. <br />"; } if(count($errors) > 0) { echo "<fieldset><legend>Errors</legend>"; echo "<div class=\"bodyText\">The following errors occured with your slideshow:</div><br />"; echo "<div class=\"error\">"; foreach($errors AS $error) { echo $error . "\n"; } echo "</div>"; echo "<br /><div class=\"bodyText\"><a href=\"javascript:history.go(-1)\">Try again</a></div>"; //JS to reload page echo "</fieldset>"; } else { $sql = "INSERT INTO Client (firstName, lastName, username, passwd, email) VALUES ('$firstname','$lastname','$username', '".md5($passwd)."', '$email')"; $query = mysql_query($sql) or die(mysql_error()); echo "</ br><div class=bodyText>$firstname $lastname has been registered as a new client.</div>"; } } ?>
  22. Nevermind, I'm an idiot. I found clear:both; within fieldset and took it out. Seems to be working fine now. Thanks for all your help.
  23. Just so I'm on the same page, you were referring to .clearfix?? I removed the class .clearfix from both the testform.ccs and throughout the webpage. I'm still having the same problem. http://www.brittanyburrowphotography.com/slideshow_new.php
  24. I removed: @import url(screen/basemod.css); @import url(screen/content.css); and an older form formatting .css that seemed to be causing some other problems. I still have the same problem unless I take out testform.css. Any ideas as to what's causing the form to be pushed down the page? http://www.brittanyburrowphotography.com/slideshow_new.php
  25. Try this: http://www.brittanyburrowphotography.com/slideshow_new.php
×
×
  • 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.