Jump to content

Destramic

Members
  • Posts

    969
  • Joined

  • Last visited

Everything posted by Destramic

  1. im looking for a script which allows you to selected a certian option on a form select box then a row of list boxes will show underneath depending on what the select box value is....does anyone know of a good link to such a script/site/tutorial if you dont understand let me know please...thank you
  2. that wrked great...thanks
  3. im working on a directory index script and i need to extract filename out of a sting which could look like this index.php news.htm and just return index or news....without the file format...does anyone know of a tutorial that could help please...thank you
  4. I've looked at the manuel and I need to replace '-' with a space...simple I know if anyone could help me with the right function please
  5. i don't think that is the problem...its not noticing the argument $function when set to strip
  6. sorry im now having an error...i was firstly just setting $function as strip but when setting it in function argument as below im getting the error: Warning: Missing argument 2 for add_strip_slashes_deep() strange <?php function add_strip_slashes_deep($value, $function) { if (function_exists($function . "slashes")) { if (get_magic_quotes_gpc() && is_array($value)) { $value = array_map("add_strip_slashes_deep", $value); } else if (is_string($value)) { $value = call_user_func($function . 'slashes', $value); } } else { echo "An error has occurred.<br />\n"; } return $value; } // Example $array = array("f\\'oo", "b\\'ar", array("fo\\'o", "b\\'ar")); $array = add_strip_slashes_deep($array, "strip"); // Output print_r($array); ?>
  7. wow that was great...thank you!
  8. i'm trying to get strip/add slashes function working but its coming up with an error on this line...but im sure im doing the right thing...does anyone know where im going wrong please or even if this is possible $function = "add"; // or strip $value = {$function}slashes($value); thank you destramic
  9. Sorry after many hours of I got it to work...dunno really how...just potching around haha...but thanks again
  10. anyone know how to get it working?
  11. i found this align label script which should align your form fields in a straigh flushed column...i'm very new to this jquery...does anyone know of a way to get this working or maybe a better tutorial/script thank you <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>align form</title> <style type="text/css"> </style> <script type="text/javascript"> jQuery.fn.autoWidth = function(options) { var settings = { limitWidth : false } if(options) { jQuery.extend(settings, options); }; var maxWidth = 0; this.each(function(){ if ($(this).width() > maxWidth){ if(settings.limitWidth && maxWidth >= settings.limitWidth) { maxWidth = settings.limitWidth; } else { maxWidth = $(this).width(); } } }); this.width(maxWidth); } $('label').autoWidth({limitWidth: 350}); </script> </head> <body> <label for="a_field">name :</label> <input id="a_field" name="a_field" type="text" /> <br/> <label for="a_field">e-mail address :</label> <input id="a_field" name="a_field" type="text" /><br/> <label for="a_field">number :</label> <input id="a_field" name="a_field" type="text" /> <br/> <label for="a_field">postcode :</label> <input id="a_field" name="a_field" type="text" /> <br/> <button id="btnNothingToDo">Do nothing</button> </body> </html>
  12. still n luck...ive been trying for hours...im pickled haha
  13. it is still coming back with the same error sorry on this line; $("#datepicker").datepicker();
  14. sorry...here is the page im trying to get it to work on if that helps...but thats the only error im getting <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <link rel="stylesheet" type="text/css" href="/css/style.css" /> <link rel="stylesheet" type="text/css" href="/ajax/jquery/datepicker/datepicker.css" /> <script type="text/javascript" src="ajax/jquery/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="ajax/jquery/datepicker/datepicker.js"></script> <script type="text/javascript" src="ajax/jquery/datepicker/datepicker.core.js"></script> <script type="text/javascript" src="/javascript/inputEmbeddedImage.js"></script> <script type="text/javascript"> $(document).ready(function() { $(".inputWithImage").each(function(){ $(this).add($(this).next()).wrapAll('<div class="imageInputWrapper"></div>'); }); }); $(function() { $("#datepicker").datepicker(); }); </script> </head> <title></title> <body> <div id="addLeague"> <form action="" name="test" method="POST"> <label for ="start_date">Start Date:</label> <input name="start_date" type="text" class="inputWithImage" title="" id="datepicker" /> <img src="C:/www/images/calendar.png" alt="Calandar" onclick="alert('Popup some calendar here!');" /><br /> <input type="submit" value="Add League" title="Submit Form" /> <input type="reset" value="Reset" title="Reset Form" /> </form> </div> <br />
  15. its a jquery that pops a calender from a input field this might explain better http://marcgrabanski.com/pages/code/jquery-ui-datepicker
  16. im trying to set this Date Picker script on my form page but its coming back with an error saying "object does not support this property or method" on this code <script>$(function() { $("#datepicker").datepicker(); }); </script> although the jquery/javascript files as included correctly its coming back with an error...does anyone know how i can fix this please?...thank you
  17. Destramic

    input css

    thank you that worked...i thought it would be something silly...thanks again
  18. Destramic

    input css

    i idealy need to do it like the code above...but as I said when using it in my css it doesn't change the look or any attribute of the input field...and I don't understand why it doesn't work...anyone please?
  19. Destramic

    input css

    i've put input[type=text] { width:250px; border:solid 1px #000000; } inside my style sheet but it is not working...does anyone know what the problem would be please?
  20. Destramic

    help!

    anyone please?
  21. Destramic

    help!

    hey...i've just made a table that looks like this called COUNTRYS counrty_id continent country_name ------------------------------------------------------- 1 Europe United Kingdom 2 Europe Netherlands 3 Asia Thailand -------------------------------------------------------- now i know this is possible but i was to display the results like this if anyone can help plese Europe- United Kingdom Nethlands Asia- Thailand thanks
  22. im writing a form validation script and have come across a small problem. the problem im having is when set my own error message: $Form->Required_Field("name", "text", "please eneter your name)"); then after viewing the form and entering an email it will show up with 2 errors for the name field...if anyone can help please form_Validation.php <?php define("FORM_ERROR_REQUIRED_VALUE", "%s : Please enter a %s"); define("FORM_ERROR_REQUIRED_EMAIL", "%s : Please enter a valid E-mail Address. Format - name@example.co.uk."); class Form_Validation { public $Fields = array(); public $Error_Messages = array(); public $Errors = false; public function Required_Field($field_name, $field_type, $error_message = NULL) { $this->Fields[$field_name]['name'] = $field_name; $this->Fields[$field_name]['type'] = $field_type; $this->Fields[$field_name]['error_message'] = $error_message; } public function Validate_Form() { foreach ($this->Fields as $field) { $field_name = $field['name']; $field_type = $field['type']; $error_message = $field['error_message']; $field_value = $_POST[$field_name]; switch ($field_type) { case "text": if (empty($field_value)) { $default_error_message = sprintf(FORM_ERROR_REQUIRED_VALUE, $field_name, $field_name); } break; case "email": if (!$this->Email_Validation($field_value)) { $default_error_message = sprintf(FORM_ERROR_REQUIRED_EMAIL, $field_name); } break; } if ($error_message && $default_error_message) { $this->Set_Error_Message($error_message); } else { $this->Set_Error_Message($default_error_message); } } } public function Display_Errors() { foreach ($this->Error_Messages as $errors) { echo $errors . "<br />\n"; } } public function Set_Error_Message($error_message) { if (!in_array($error_message, $this->Error_Messages)) { $this->Error_Messages[]= $error_message; } } public function Email_Validation($email) { return eregi("^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$", $email); } } ?> form.php <?php require_once $_SERVER['DOCUMENT_ROOT'] . "\classes\Form_Validation.php"; $Form = new Form_Validation; $Form->Required_Field("name", "text", "please eneter your name)"); $Form->Required_Field("email", "email"); $Form->Validate_Form(); $Form->Display_Errors(); echo <<<HTML <form action="{$_SERVER['REQUEST_URI']}" name="test" method="POST"> <fieldset> <legend>Add League</legend> name: <input type="text" name="name" title="name"/><br /> email : <input type="text" name="email" title="email" /><br /> <input type="submit" value="Add League" title="Submit Form" /> <input type="reset" value="Reset" title="Reset Form" /> </fieldset> </form> HTML; ?>
  23. well thank you anyways so to have wasted your time...back to the drawing board
  24. heres the two pages if you can help please Form_Validation.php <?php class Form_Validation { public $Form_Name; public $Fields = array(); public $Method = "POST"; public $Errors = false; public function __construct($form_name) { $this->Form_Name = $form_name; } public function Validate_Field($field_name, $field_type, $error_message) { $this->Fields[$field_name]['name'] = $field_name; $this->Fields[$field_name]['type'] = $field_type; $this->Fields[$field_name]['error_message'] = $error_message; } public function Display_Errors() { foreach ($this->Fields as $field) { $field_name = $field['name']; $field_type = $field['type']; $error_message = $field['error_message']; echo $field_value = ${"_" . $this->Method}[$field_name]; } } public function Validate_Form() { } } ?> Form.php <?php require_once $_SERVER['DOCUMENT_ROOT'] . "Form_Validation.php"; $Form = new Form_Validation("test"); $Form->Validate_Field("name", "text", "Please "); $Form->Display_Errors(); echo <<<HTML <form action="{$_SERVER['REQUEST_URI']}" name="test" method="POST"> <fieldset> <legend>Add League</legend> <label for="name">League Name:</label> <input type="text" name="name" title="League Name"/><br /> <input type="submit" value="Add League" title="Submit Form" /> <input type="reset" value="Reset" title="Reset Form" /> </fieldset> </form> HTML; ?>
  25. this is strange...its not working...maybe something to do with my setting with php/apache? which may be stopping it from working?
×
×
  • 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.