Jump to content
Larry Ullman's Book Forums

thara

Members
  • Posts

    54
  • Joined

  • Last visited

thara's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I am trying to make SEO friendly URLs of using apache mod_rewrite. My normal URLs is something like this - index.php?p=about index.php?p=contact index.php?p=this My expecting SEO friendly URLs should be something similar to this - localhost/php_advance/ch02/about localhost/php_advance/ch02/contact localhost/php_advance/ch02/this I tried it with creating a .htaccess file and doing some changes to my apache httpd.conf file. This is my .htaccess file <ifModule mod_rewrite.c> # Turn on the engine: RewriteEngine on # Set the base to this directory: RewriteBase /php_advance/ch02/ # Redirect certain paths to index.php: RewriteRule ^(about|contact|this|that|search)/?$ index.php?p=$1 </ifModule> And also, At the end of the httpd.conf file, I added some code like this - <Directory "C:/wamp/www/php_advance/ch02"> AllowOverride All </Directory> NOTE: I am using WAMP server and Windows 07 But this coding is not working for me. Hope someone will help me out. Thank you.
  2. I have modified form_functions.inc.php to radio button for suit for me. But It seems its not working.. This is my code so far.. from form function if (preg_match('/sex\d{1}$/', $name)) { $i = substr($name, -1); $name = substr($name, 0, 3); $sex = array(1=>'Male', 'Female' ); // Display the error first: if (array_key_exists($name, $errors)) { echo ' <span class="inline-error">' . $errors[$name] . "</span>\n"; } echo '<input type="' . $type . '" name="' . $name . '" value="' . $i . '" /> ' . $sex[$i] . ' '; } This is from validation code.. // Check for gender: $sex = array(); for ($i=1, $count=2; $i <= $count; $i++) { if (isset($_POST['sex'. $i])) { $sex[] = $_POST['sex'. $i]; } } // end for loop if (empty($sex)){ $reg_errors['sex1'] = 'You have NOT entered your gender type!'; } This from HTML <div class="last-child"> <?php for ($i=1, $count=2; $i <= $count; $i++) { create_form_input('sex' . $i, 'radio', $reg_errors); } ?> </div> radio button working.. but validation not working its always going to error message.. hope someone help me out this.. thank you.
  3. Hello... I have a form to get some urls from users. Eg: Web Address, Facebook Address, Twitter Address, Google+ address etc... My problem is how I validate these urls when they submit the form. I tried to validate URL in PHP by using the FILTER_VALIDATE_URL or simply, using regular expression. Here, I would like to know what are the best methods to get such a urls from users. Is it always good to let them to enter protocol? sometimes they may not know it is http, https, ftp, ftps.. etc. I think it is something hard to do some users. I tried something like this using FILTER_VALIDATE_URL, But it always use protocol and sometime I am confusing how its work.. // validate url $url = '[url="http://www.example.com%27;"]http://www.example.com';[/url] if (filter_var( $url, FILTER_VALIDATE_URL)){ echo "<br>valid"; } else { echo "<br>invalid"; } [b]OUTPUT[/b] : valid // validate url $url = 'hp://www.example.com'; if (filter_var( $url, FILTER_VALIDATE_URL)){ echo "<br>valid"; } else { echo "<br>invalid"; } [b]OUTPUT[/b] : valid // validate url $url = 'http://example.com'; if (filter_var( $url, FILTER_VALIDATE_URL)){ echo "<br>valid"; } else { echo "<br>invalid"; } [b]OUTPUT[/b]: valid // validate url $url = 'http://example.com?id=32&name=kamalani'; if (filter_var( $url, FILTER_VALIDATE_URL)){ echo "<br>valid"; } else { echo "<br>invalid"; } [b]OUTPUT[/b] : valid Can you tell me what are the best ways to get urls from user and how those validate? Any comments are greatly appreciating.. Thank you.
  4. ok.. thanks you. also I would like to know is there another way to get the same result using HTML table format like I posted above?
  5. Thanks for your sugestion. But can you tell me..How can I get <li> items into 2 columns?
  6. Thank you HartleySan... this is a link for a image.. http://www.freeimagehosting.net/6sfhz I think you will get an idea actually what I am going to do whit this.. thanks again...
  7. Oops.... My image is not displaying wiht my post.. can you please tell me how can I attach an image with this post...? I tried to find an option but fail to find.
  8. this is a screan shot showing actually what I am tring to do is... Each category has its own subjects and those subjects need to display in a table with 2 columns.
  9. thanks for reply.. SQL return the values properly...there are category_id, category_name, subject_id, subject_name. I have started the session properly in my configuration file and have included to this page. I am trying to display above return data into a list something like this.. Catagory 01 subjects1 subjects4 subjects2 subjects5 subjects3 subjects6 Catagory 02 subjects1 subjects4 subjects2 subjects5 subjects3 subjects6 Catagory 03 subjects1 subjects4 subjects2 subjects5 subjects3 subjects6 I tried to do it like this. Its working as 50%. But I need to display subjects under each categories in a table with 2 columns. $catID = false; while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) { echo '<div>'; if ( $catID != $row['ci']) { echo '<h3>Category 01: <span>' . $row['cn'] . '</span><span></span></h3>'; } echo '<div class="container">'; echo '<p>' . $row['sn']. '</p>'; // This subjects I need to display in a table with 2 columns.. $catID = $row['ci']; echo '</div>'; echo '</div>'; } The problem I face is, when I am tring to add the subjects into a table.. This is my HTML design.. <div> <h3>Category 01: <span>Information Technology</span><span></span></h3> <div class="container"> <table> <tr> <td width="50%"> <input type="checkbox" value="1" name="category[]">Subject1 </td> <td width="50%"> <input type="checkbox" value="2" name="category[]">Subject4 </td> </tr> <tr> <td width="50%"> <input type="checkbox" value="1" name="category[]">Subject2 </td> <td width="50%"> <input type="checkbox" value="2" name="category[]">Subject5 </td> </tr> <tr> <td width="50%"> <input type="checkbox" value="1" name="category[]">Subject3 </td> <td width="50%"> <input type="checkbox" value="2" name="category[]">Subject6 </td> </tr> </table> </div> </div>
  10. I am going to create a HTML form dynamically with php. Using that form users can select subjects under different category. A category and Its subjects have broken to one logical section and have applied jquery accordion. In my form I need to create more logical section like that. this is the HTML structure of the form..(which need to create dynamically with php) <form action="" method="post"> <div id="accordion"> <!-- logical section 1 --> <div> <h3>Category 01: <span>category name</span><span></span></h3> <div class="container"> <table> <tr> <td width="50%"> <input type="checkbox" value="1" name="subject[]">subject1 </td> <td width="50%"> <input type="checkbox" value="2" name="subject[]">subject2 </td> </tr> </table> </div> </div> <!-- logical section 2 --> <div> <h3>Category 02: <span>category name</span><span></span></h3> <div class="container"> <table> <tr> <td width="50%"> <input type="checkbox" value="1" name="subject[]">subject1 </td> <td width="50%"> <input type="checkbox" value="2" name="subject[]">subject2 </td> </tr> </table> </div> </div> </div> </form> Can anybody tell my where I am going wrong? I troubled how to create inner table with 2 columns.
  11. Thanks for all answers.... I got a solution using IN() in mysql... thanks again..
  12. thanx for response. My table is institute_images and it has image_id, image_name, image_type, institute_id coloumns. designation array's values I use for image_type values. In my query I need to check is there any images in db with image_type value is one of my designation array's value.
  13. hi.. everyone.. This is a sql query problem that I have uncounted and have been in the same script for hours. But Still I couldn't get it to work. I need to get a image from database and its type should be one of a value from my $designation array. The query should check $designation array's value with database and if its match with one of a value in database then query can retrieve one row. This is my designation array. its value I use for image type in my db. $designation = array ( 'Managing Director', 'Manager', 'Director', 'The Principal', 'Deputy Principal', 'Proprietor', 'Assistant Manager', 'Head Master'); My problem is how can I check these value exit in my table and how can I make a query for this. In query where condition is confusing to me... any comments are greatly appreciated. Thank you..
  14. Yes.. I used tutor_institute directory and sometimes used lanka_institute directory too for experiments porpose. when I use both directories I did it correctly in my htaccess and browser url. But still I couldn't it to get working. actually what has happend there... I followed more online tutorials to subject and all of them are fomfort for me. but I cant get it work in my project... any comments are greatly appreciated. Thank you..
×
×
  • Create New...