Jump to content

maddie2120

Members
  • Posts

    12
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

maddie2120's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Okay I think I prefer the simpler statement. Many thanks again, I'm still working on this application and I'm sure I'll run into all sorts of problems so I'll certainly be using this forum a lot.
  2. Thank you very much, that's done the trick - not sure why it includes the additional bit, is it just testing for a boolean value?
  3. Yes, if the form has not been submitted then display the form, if it has then go to: // Let's go to the List page Header("Refresh: 1;url=list.php"); echo <<< _HTML_END_ Reminder Added, redirecting ... _HTML_END_; } else { // Error occurred let's notify it echo( $error ); } }
  4. Yes I accidentally commented out the following code at the top of the page: <?php include('../dbconnect.php'); // database connectivity file if($_POST['step'] != '1') { ?> Unfortunately now I keep getting the 'undefined index' error message, the 'if' statement refers to the hidden field in the form. Any ideas as to how I can fix this? I have an understanding of php but I'm really a novice at this.
  5. Thank you for your quick response, I must have had a senior moment - I'd commented out the 'if' statement at the top of the page. Hopefully problem is sorted now. Many thanks
  6. It sounds as though you may not have permission to access php at this level, you might have to contact your server administrator and ask them to do it for you. Hope this helps
  7. Hi I found this php code which I'm adapting for a project, and I've run into the curly braces problem - could someone look at it for me as I've been looking for hours and still can't sort it out!. It's a form that adds dates and information to a database, the problem is at the error handling stage towards the end of the script - if anyone has any ideas I would be very grateful <form name="reminder" action="remind.php" method="post"> <table border='0' align='center' cellpadding="5" cellspacing="5"> <tr> <td>First Name:</td> <td colspan="3"> <input name="fname" type="text" maxlength="30" /> </td> </tr> <tr> <td>Last Name:</td> <td colspan="3"> <input name="lname" type="text" maxlength="30" /> </td> </tr> <tr> <td>Email Address:</td> <td colspan="3"> <input name="email" type="text" maxlength="50" /> </td> </tr> <tr> <td>Comapny:</td> <td colspan="3"> <input name="company" type="text" maxlength="50" /> </td> </tr> <tr> <td>Date Certificate taken:</td> <td> Day:<br /> <select name="day"> <?php for($counter=1;$counter<=31;$counter++) { if($counter < 10) $prefix = "0"; else $prefix = ""; echo("\n<option>$prefix$counter</option>"); } ?> </select></td> <td>Month:<br /> <select name="month"> <?php for($counter=1;$counter<=12;$counter++) { if($counter < 10) $prefix = 0; else $prefix = ""; echo("\n<option>$prefix$counter</option>"); } ?> </select></td> <td>Year:<br /> <select name="year"> <?php $current_year = date("Y"); for($counter=$current_year;$counter>=$current_year-5;$counter--) { echo("\n<option>$counter</option>"); } ?> </select></td> </tr> <tr> <td id="alert">*Please complete all fields</td> <td colspan="3"> <input name="step" type="hidden" value="1" /> <input name="submit" type="submit" value="add" /> </td> </tr> </table> </form> </div> </body> </html> <?php // Check for errors in the submitted form... } else { $error = ""; $date = date( "dmY" ); $renew_date = $_POST['day'].$_POST['month'].$_POST['year']; if( empty($_POST['fname']) ) $error .= "Please enter a first name<br />"; if( empty($_POST['lname']) ) $error .= "Please enter a last name<br />"; if( empty($_POST['email']) ) $error .= "Please enter a valid email address<br />"; if(!isEmail($email) ) $error .= "You have entered an invalid e-mail address, please try again.<br />"; if( !checkdate( $_POST['day'], $_POST['month'], $_POST['year'] )) $error .= "The date entered is invalid, please check<br />"; if( empty( $error ) ) { // No error let's add the entry mysql_query( "INSERT INTO clients('first_name', 'last_name', 'email', 'enrolled', 'company') VALUES('".addslashes($_POST['fname'])."', '".addslashes($_POST['lname'])."', '".addslashes($_POST['email'])."', '".addslashes($renew_date)."', '".addslashes($_POST['company'])."')" ); // Let's go to the Reminder List page Header("Refresh: 1;url=list.php"); echo <<< _HTML_END_ Reminder Added, redirecting ... _HTML_END_; } else { // Error occurred let's notify it echo( $error ); } } ?>
  8. Thanks - I was more interested in any php date scripts combined with cgi that could do the job, sorry I didn't make that clear
  9. Hi thanks for the help, yes I think the cron job idea is the way to go. Does anyone know of any scripts already out there that can be tweaked for individual use?
  10. Hi could someone point me in the right direction, I'm trying to write an application that sends out reminder emails to clients who need to renew their qualifications online. Does anyone know of an automated script or one that could be adapted and used. Any help would be greatly appreciated. Maddie
  11. Thank you for the link, the code looks really good unfortunately I need to use it in an array as in my original code, the code mentioned only has one column so I would need to create an array and I don't think I have the skills to do it. I also didn't understand how the '$product' variable would work as it didn't seem to be assigned anything - is that correct or is this just my lack of understanding, I have copied the code below from that forum thread written by: Ober Dated June 09 2006 (hope that's okay) <table cellspacing="3" cellpadding="3"> <?php $query = "SELECT product FROM selling_items ORDER BY prod_id"; $result = mysql_query($query) or die("There was a problem with the SQL query: " . mysql_error()); if($result && mysql_num_rows($result) > 0) { $i = 0; $max_columns = 3; while($row = mysql_fetch_array($result)) { // make the variables easy to deal with extract($row); // open row if counter is zero if($i == 0) echo "<tr>"; // make sure we have a valid product if($product != "" && $product != null) echo "<td>$product</td>"; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo "</tr>"; $i=0; } // end if } // end while } // end if results // clean up table - makes your code valid! if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } ?> </tr> </table> Any ideas as to how I could combine the two or if anyone could point me in the right direction I would be most grateful - many thanks
  12. Hi everyone, I'm having real problems trying to retrieve database records in a 3 column layout, I got there eventually with a huge amount of help. Unfortunately the code will only display records that are divisable by by three; for example for a database table that has 45 records there is no problem, as all records can be displayed in a 3 column layout. However if the table contains 47 records it won't display the 2 odd records. My php skills are limited so I need all the help I can get. I'm a bit desperate to sort this out for a project I'm doing, any help would be greatly appreciated - here is the php code: $total = count($records); $nocol = 3; $norows = $total / $nocol; for ($i=1; $i <= $norows; $i++) { $cell = 0; echo "<tr>"; for($col=1; $col <= $nocol; $col++) { echo "<td>"; if ($col == 1) { $cell += $i; echo '<strong class="navtext">'.$records[$cell - 1]['ret_name'].'</strong><br />'; echo $records[$cell - 1]['ret_add1'].'<br />'; echo $records[$cell - 1]['ret_add2'].'<br />'; echo $records[$cell - 1]['ret_town'].'<br />'; echo $records[$cell - 1]['ret_county'].'<br />'; echo $records[$cell - 1]['ret_pcode'].'<br />'; echo $records[$cell - 1]['ret_phone'].'<br />'; echo $records[$cell - 1]['ret_email'].'<br />'; echo $records[$cell - 1]['ret_web'].'<br />'; } else { $cell += $norows; echo '<strong class="navtext">'.$records[$cell - 1]['ret_name'].'</strong><br />'; echo $records[$cell - 1]['ret_add1'].'<br />'; echo $records[$cell - 1]['ret_add2'].'<br />'; echo $records[$cell - 1]['ret_town'].'<br />'; echo $records[$cell - 1]['ret_county'].'<br />'; echo $records[$cell - 1]['ret_pcode'].'<br />'; echo $records[$cell - 1]['ret_phone'].'<br />'; echo $records[$cell - 1]['ret_email'].'<br />'; echo $records[$cell - 1]['ret_web'].'<br />'; } echo"</td>"; } echo"</tr>"; } I'm also trying to paginate the results, is this actually possible when using a three column layout? I look forward to any suggestions.
×
×
  • 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.