Search the Community
Showing results for tags 'get function'.
-
I would like to thank everyone helping me on my previous question. This is the last question i have. Currently i have my program running but i just need to figure out how to use the get function on check boxes and text boxes. Here is the code i am using for the php mysql part of it. <?php $con=mysqli_connect("localhost","username","password","dbase"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $sql="SELECT * from table where id = '".$_GET["id"]."' "; $rs=mysql_query($sql,$conn) or die(mysql_error()); ?> I know this is working by echoing what i needed to display. But i am in a situation where the form is extremely large and i need to display it in the what it is setup currently. Here is an example of the form <form name="standard" method="post" action="submit.php"> <table width="100%" height="1295" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top" background="../test report page/images/test form standard large2.jpg" ><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="35" height="122"> </td> <td width="920"> </td> <td width="45"> </td> </tr> <tr> <td height="49"> </td> <td valign="top"><table width="100%" height="44" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="25%" valign="bottom"> <input name="water-purveyor" type="text" id="water-purveyor" size="25" height="25" value="<?php echo'.$result["water-purveyor"].' ?>" /></td> <td width="20%" valign="bottom"> <input type="text" name="facility-contact" id="facility-contact" height="25" value="<?php echo'.$result["facility-contact"].' ?>" /></td> <td width="55%" valign="bottom"><input type="text" name="facility-address" id="facility-address" size="50" height="25" value="<?php echo'.$result["facility-address"].' ?>" /></td> </tr> </table></td> <td> </td> </tr> <tr> <td width="28%" height="85" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="2" rowspan="2"> </td> <td width="15%" height="33"><input type="checkbox" name="v1-na" id="v1-na" value="<?php echo'.$result["v1-na"].' ?>" /></td> <td width="14%"><input type="checkbox" name="v1-good" id="v1-good" value="<?php echo'.$result["v1-good"].' ?>" /></td> <td width="15%"><input type="checkbox" name="v1-poor" id="v1-poor" value="<?php echo'.$result["v1-poor"].' ?>" /></td> <td width="15%"><input type="checkbox" name="v1-fail" id="v1-fail" value="<?php echo'.$result["v1-fail"].' ?>" /></td> </tr> <tr> <td height="35" valign="top" style="padding-top:4px;"><input type="checkbox" name="v2-na" id="v2-na" value="<?php echo'.$result["v2-na"].' ?>" /></td> <td valign="top" style="padding-top:4px;"><input type="checkbox" name="v2-good" id="v2-good" value="<?php echo'.$result["v2-good"].' ?>" /></td> <td valign="top" style="padding-top:4px;"><input type="checkbox" name="v2-poor" id="v2-poor" value="<?php echo'.$result["v2-poor"].' ?>" /></td> <td valign="top" style="padding-top:4px;"><input type="checkbox" name="v2-fail" id="v2-fail" value="<?php echo'.$result["v2-fail"].' ?>" /></td> </tr> </table> </form> Can you tell me if this will work or can you give me some helpful ways to make this work. Again thank you for all your help. E
-
Below is the code for my Latest post Widget, I want to configure the widget to exclude 4 previous post and add paginationat the bottom instead of the load more function. I know that <?php query_posts('posts_per_page=12&offset=4'); if(have_posts():while (have_posts(): the_post()p ?> will work. I need to configure the below code to allow me to exclude posts and not loadmore. Thanks In advanced! --------------------------------------------------------------------------------- <?php class wpShowerIndexLatestEntriesWidget extends WP_Widget { function __construct() { parent::__construct( 'wpshower_index_latest_entries', 'Homepage Latest Entries', array('description' => __('Widget for displaying latest entries', 'outspoken')) ); } /** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { extract($args); $limit = $instance['limit']; $options = array( 'posts_per_page' => $limit + 1 ); $exclude = wpShower::getIndexPosts('exclude'); if (!empty($exclude)) $options['exclude'] = implode(',', $exclude); $posts = get_posts($options); $title = apply_filters('widget_title', $instance['title']); echo $before_widget.$before_title.$title.$after_title; if (empty($posts)) { echo '<div class="outspoken-error">'; if (is_admin_bar_showing()) { printf(__('No posts to show, please <a href="%s">add one</a>', 'outspoken'), admin_url('edit.php')); } else { _e('No posts to show', 'outspoken'); } echo '</div>'.$after_widget; return; } global $post; $show_categories = get_theme_mod('outspoken_home_categories'); for ($i = 0; $i < $limit; $i++): if (!isset($posts[$i])) break; $post = $posts[$i]; setup_postdata($post); $image = outspoken_post_image($post->ID, 'post-thumbnail'); ?> <article> <a href="<?php the_permalink(); ?>"><img src="<?php echo esc_url($image); ?>" alt="<?php the_title_attribute(); ?>" title="<?php the_title_attribute(); ?>" /></a> <div> <?php if ($show_categories): ?> <div class="meta-top"><?php outspoken_entry_categories(); ?></div> <?php endif; ?> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <?php $meta = outspoken_index_meta(false, false); if ($meta != ''): ?> <div class="meta"><?php echo $meta; ?></div> <?php endif; ?> <div class="summary"><?php the_excerpt(); ?></div> </div> </article> <?php endfor; wp_reset_postdata(); if (isset($posts[$limit])): ?> <div class="load-more"><span class="loader"></span><span class="text">Load More Posts</span></div> <script type="text/javascript"> jQuery(function() { var latest_entries_limit = <?php echo $limit; ?>; var latest_entries_offset = latest_entries_limit; jQuery('#<?php echo $args['widget_id']; ?>').on('click', '.load-more', function() { if (latest_entries_offset == 0) return; jQuery(this).addClass('active'); jQuery.ajax({ type: 'post', dataType: 'json', url: '<?php echo admin_url('admin-ajax.php?action=wpshower_latest_entries'); ?>', data: { limit: latest_entries_limit, offset: latest_entries_offset }, success: function(response) { for (var i = 0; i < response.posts.length; i++) { jQuery('#<?php echo $args['widget_id']; ?> .load-more').before( '<article>' + '<a href="' + response.posts[i].permalink + '"><img src="' + response.posts[i].image + '" alt="' + response.posts[i].title + '" title="' + response.posts[i].title + '" /></a>' + '<div>' + '<div class="meta-top">' + response.posts[i].categories + '</div>' + '<h2><a href="' + response.posts[i].permalink + '">' + response.posts[i].title + '</a></h2>' + '<div class="meta">' + response.posts[i].date + response.posts[i].comments + '</div>' + '<div class="summary">' + response.posts[i].excerpt + '</div>' + '</div>' + '</article>' ); } if (response.more) { latest_entries_offset += latest_entries_limit; jQuery('#<?php echo $args['widget_id']; ?> .load-more').removeClass('active'); } else { latest_entries_offset = 0; jQuery('#<?php echo $args['widget_id']; ?> .load-more').hide(); } if (scroll != false) scroll.loadMore(); } }); }); }); </script> <?php endif; echo $after_widget; } /** * Back-end widget form. * * @see WP_Widget::form() * * @param array $instance Previously saved values from database. */ public function form($instance) { if (isset($instance['title'])) $title = $instance['title']; else $title = __('Latest Entries', 'outspoken'); if (isset($instance['limit'])) $limit = $instance['limit']; else $limit = 4; ?> <p> <label for="<?php echo $this->get_field_name('title'); ?>"><?php _e('Title:', 'outspoken'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /> </p> <p> <label for="<?php echo $this->get_field_name('limit'); ?>"><?php _e('How many items:', 'outspoken'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" type="text" value="<?php echo $limit; ?>" /> </p> <?php } /** * Sanitize widget form values as they are saved. * * @see WP_Widget::update() * * @param array $new_instance Values just sent to be saved. * @param array $old_instance Previously saved values from database. * * @return array Updated safe values to be saved. */ public function update($new_instance, $old_instance) { $instance = array(); $instance['title'] = !empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; $instance['limit'] = !empty($new_instance['limit']) ? intval($new_instance['limit']) : 4; return $instance; } }