PHP - Adding A Button Next To Another Button
I am editing this page (attached) and I'm trying to create another button to an external link. I thought it would be as easy as copying and pasting the text to create a second button but that kills the entire page. Any suggestions on how I might do this? This link is internally but the second button I need to open an external URL in a new window. The section of PHP: <div class="clear"></div> <?php // Ask a question about this product ?> <?php if (VmConfig::get('ask_question', 0) == 1) { $askquestion_url = JRoute::_('index.php?option=com_virtuemart&view=productdetails&task=askquestion&virtuemart_product_id=' . $this->product->virtuemart_product_id . '&virtuemart_category_id=' . $this->product->virtuemart_category_id . '&tmpl=component', FALSE); ?> <div class="clear"></div> <div class="ask-a-question"> <a class="ask-a-question" href="<?php echo $askquestion_url ?>" rel="nofollow" ><i class="fas fa-envelope"></i><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL') ?></a> </div> <?php } ?> <?php // Back To Category Button if ($this->product->virtuemart_category_id) { $catURL = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$this->product->virtuemart_category_id, FALSE); $categoryName = vmText::_($this->product->category_name) ; } else { $catURL = JRoute::_('index.php?option=com_virtuemart'); $categoryName = vmText::_('COM_VIRTUEMART_SHOP_HOME'); } ?>
<?php /** * * Show the product details page * * @package VirtueMart * @subpackage * @author Max Milbers, Eugen Stranz, Max Galt * @link http://www.virtuemart.net * @copyright Copyright (c) 2004 - 2014 VirtueMart Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * @version $Id: default.php 9292 2016-09-19 08:07:15Z Milbo $ */ // Check to ensure this file is included in Joomla! defined('_JEXEC') or die('Restricted access'); /* Let's see if we found the product */ if (empty($this->product)) { echo vmText::_('COM_VIRTUEMART_PRODUCT_NOT_FOUND'); echo '<br /><br /> ' . $this->continue_link_html; return; } echo shopFunctionsF::renderVmSubLayout('askrecomjs',array('product'=>$this->product)); if(vRequest::getInt('print',false)){ ?> <body onload="javascript:print();"> <?php } ?> <div class="product-container productdetails-view productdetails"> <div class="vm-product-wrap row"> <div class="vm-product-media-img col-sm-5"> <?php echo $this->loadTemplate('images'); $count_images = count ($this->product->images); if ($count_images > 1) { echo $this->loadTemplate('images_additional'); } ?> </div> <!--/.col-sm-5--> <div class="vm-product-details-inner col-sm-7"> <div class="vm-product-title"> <div class="pull-left"> <?php // Product Title ?> <h2><?php echo $this->product->product_name ?></h2> <?php // Product Title END ?> </div> <div class="vm-rating pull-left"> <?php if (VmConfig::get('display_stock', 1)) { ?> <?php if ($this->product->product_in_stock > 0) { ?> <div class="product-in-stock"> <i class="pe pe-7s-check"></i> <?php echo JText::_('VM_IN_STOCK'); ?> <span><?php echo $this->product->product_in_stock; ?></span> </div> <?php } else { ?> <div class="product-in-stock"> <i class="pe pe-7s-less"></i> <?php echo JText::_('VM_OUT_OF_STOCK'); ?> </div> <?php } ?> <?php } ?> <?php echo shopFunctionsF::renderVmSubLayout('rating',array('showRating'=>$this->showRating,'product'=>$this->product)); ?> </div> </div> <?php echo $this->product->event->afterDisplayTitle ?> <?php if (is_array($this->productDisplayShipments)) { echo '<div class="vm-product-shipments">'; foreach ($this->productDisplayShipments as $productDisplayShipment) { echo '<div class="vm-product-shipment">'; echo $productDisplayShipment . '<br />'; echo '</div>'; } echo '</div>'; } //In case you are not happy using everywhere the same price display fromat, just create your own layout //in override /html/fields and use as first parameter the name of your file echo shopFunctionsF::renderVmSubLayout('prices',array('product'=>$this->product,'currency'=>$this->currency)); echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$this->product,'position'=>'ontop')); echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$this->product,'position'=>'normal')); ?> <?php if (!empty($this->product->product_s_desc)) { ?> <div class="product-short-description"> <h4><i class="pe pe-7s-note"></i><?php echo JText::_('VM_PRODUCT_SHORT_DESC');?></h4> <?php // Removed line because it was generating <br>: echo nl2br($this->product->product_s_desc); echo $this->product->product_s_desc; ?> </div> <?php } // Product Short Description END ?> <?php // Manufacturer of the Product if (VmConfig::get('show_manufacturers', 1) && !empty($this->product->virtuemart_manufacturer_id)) { echo '<div class="clear"></div><span class="product-manufacturer">' . vmText::_('COM_VIRTUEMART_PRODUCT_DETAILS_MANUFACTURER_LBL') . ':' . $this->loadTemplate('manufacturer') . '</span><div class="clear"></div>'; } ?> <div class="spacer-buy-area"> <?php echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$this->product)); echo shopFunctionsF::renderVmSubLayout('stockhandle',array('product'=>$this->product)); ?> </div> <div class="clear"></div> <?php // Ask a question about this product ?> <?php if (VmConfig::get('ask_question', 0) == 1) { $askquestion_url = JRoute::_('index.php?option=com_virtuemart&view=productdetails&task=askquestion&virtuemart_product_id=' . $this->product->virtuemart_product_id . '&virtuemart_category_id=' . $this->product->virtuemart_category_id . '&tmpl=component', FALSE); ?> <div class="clear"></div> <div class="ask-a-question"> <a class="ask-a-question" href="<?php echo $askquestion_url ?>" rel="nofollow" ><i class="fas fa-envelope"></i><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL') ?></a> </div> <?php } ?> <?php // Back To Category Button if ($this->product->virtuemart_category_id) { $catURL = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$this->product->virtuemart_category_id, FALSE); $categoryName = vmText::_($this->product->category_name) ; } else { $catURL = JRoute::_('index.php?option=com_virtuemart'); $categoryName = vmText::_('COM_VIRTUEMART_SHOP_HOME'); } ?> <div class="back-to-category"> <a href="<?php echo $catURL ?>" class="product-details"><i class="fas fa-folder-open"></i><?php echo vmText::sprintf('COM_VIRTUEMART_CATEGORY_BACK_TO',$categoryName) ?></a> </div> <?php // Product Navigation if (VmConfig::get('product_navigation', 1)) { ?> <hr style="width:100%;" /> <div class="product-neighbours"> <?php if (!empty($this->product->neighbours ['previous'][0])) { $prev_link = JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $this->product->neighbours ['previous'][0] ['virtuemart_product_id'] . '&virtuemart_category_id=' . $this->product->virtuemart_category_id, FALSE); echo JHtml::_('link', $prev_link, $this->product->neighbours ['previous'][0] ['product_name'], array('rel'=>'prev', 'class' => 'previous-page', 'data-toggle' => 'tooltip', 'title' => $this->product->neighbours ['previous'][0] ['product_name'], 'data-dynamic-update' => '1')); } else { echo '<span class="empty-previous-page fas fa-ban"></span> '; } if (!empty($this->product->neighbours ['next'][0])) { $next_link = JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $this->product->neighbours ['next'][0] ['virtuemart_product_id'] . '&virtuemart_category_id=' . $this->product->virtuemart_category_id, FALSE); echo JHtml::_('link', $next_link, $this->product->neighbours ['next'][0] ['product_name'], array('rel'=>'next','class' => 'next-page','data-toggle' => 'tooltip', 'title' => $this->product->neighbours ['next'][0] ['product_name'],'data-dynamic-update' => '1')); } else { echo '<span class="empty-next-page fas fa-ban"></span>'; } ?> </div> <?php } // Product Navigation END ?> <?php // Product Edit Link echo $this->edit_link; // Product Edit Link END ?> </div> <!--/.col-sm-7--> <div class="clear"></div> </div> <!--/.row--> <div style="margin-top:25px;" class="row"> <div class="col-sm-12"> <?php // PDF - Print - Email Icon if (VmConfig::get('show_emailfriend') || VmConfig::get('show_printicon') || VmConfig::get('pdf_icon')) { ?> <div class="icons"> <?php $link = 'index.php?tmpl=component&option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $this->product->virtuemart_product_id; echo '<span class="pdf-icon">'; echo $this->linkIcon($link . '&format=pdf', 'COM_VIRTUEMART_PDF', 'pdf_button', 'pdf_icon', false); echo '</span>'; //echo $this->linkIcon($link . '&print=1', 'COM_VIRTUEMART_PRINT', 'printButton', 'show_printicon'); echo $this->linkIcon($link . '&print=1', 'COM_VIRTUEMART_PRINT', 'printButton', 'show_printicon',false,true,false,'class="printModal"'); $MailLink = 'index.php?option=com_virtuemart&view=productdetails&task=recommend&virtuemart_product_id=' . $this->product->virtuemart_product_id . '&virtuemart_category_id=' . $this->product->virtuemart_category_id . '&tmpl=component'; echo $this->linkIcon($MailLink, 'COM_VIRTUEMART_EMAIL', 'emailButton', 'show_emailfriend', false,true,false,'class="recommened-to-friend"'); ?> <div class="clear"></div> </div> <?php } // PDF - Print - Email Icon END ?> <?php // event onContentBeforeDisplay echo $this->product->event->beforeDisplayContent; ?> <div class="products-desc-tab"> <ul id="myTab" class="nav nav-tabs" role="tablist"> <?php if (!empty($this->product->product_desc)) { ?> <li role="presentation" class="active"> <a href="#desc" aria-controls="desc" role="tab" data-toggle="tab"> <i class="pe pe-7s-note"></i><?php echo vmText::_('VM_PRODUCT_DESC_TITLE') ?> </a> </li> <?php } // Product Description END if ($this->showReview) { ?> <li role="presentation"> <a href="#review" data-toggle="tab" aria-controls="review" role="tab"> <i class="pe pe-7s-like2"></i><?php echo JText::_('VM_PRODUCT_REVIEWS');?> </a> </li> <?php } ?> </ul> <div class="tab-content"> <?php if (!empty($this->product->product_desc)) { ?> <div role="tabpanel" class="tab-pane desc fade active in" id="desc"> <div class="product-description"> <?php /** @todo Test if content plugins modify the product description */ ?> <?php echo $this->product->product_desc; ?> </div> </div> <?php } // Product Description END if ($this->showReview) { ?> <div role="tabpanel" class="tab-pane review" id="review"> <?php echo $this->loadTemplate('reviews'); ?> </div> <?php } ?> </div> <div class="clear"></div> </div> <!--/. products-desc-tab--> <?php // Product Packaging $product_packaging = ''; if ($this->product->product_box) { ?> <div class="product-box"> <?php echo vmText::_('COM_VIRTUEMART_PRODUCT_UNITS_IN_BOX') .$this->product->product_box; ?> </div> <?php } // Product Packaging END ?> <?php echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$this->product,'position'=>'onbot')); echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$this->product,'position'=>'related_products','class'=> 'product-related-products','customTitle' => true )); echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$this->product,'position'=>'related_categories','class'=> 'product-related-categories')); ?> <?php // onContentAfterDisplay event echo $this->product->event->afterDisplayContent; // Show child categories if ($this->cat_productdetails) { echo $this->loadTemplate('showcategory'); } ?> </div> <!--/.col-sm-12--> </div> <!--/.row--> <?php $j = 'jQuery(document).ready(function($) { $("form.js-recalculate").each(function(){ if ($(this).find(".product-fields").length && !$(this).find(".no-vm-bind").length) { var id= $(this).find(\'input[name="virtuemart_product_id[]"]\').val(); Virtuemart.setproducttype($(this),id); } }); });'; //vmJsApi::addJScript('recalcReady',$j); if(VmConfig::get ('jdynupdate', TRUE)){ /** GALT * Notice for Template Developers! * Templates must set a Virtuemart.container variable as it takes part in * dynamic content update. * This variable points to a topmost element that holds other content. */ $j = "Virtuemart.container = jQuery('.productdetails-view'); Virtuemart.containerSelector = '.productdetails-view'; //Virtuemart.recalculate = true; "; vmJsApi::addJScript('ajaxContent',$j); $j = "jQuery(document).ready(function($) { $('[data-toggle=\"tooltip\"]').tooltip();Virtuemart.stopVmLoading();var msg = '';$('a[data-dynamic-update=\"1\"]').off('click', Virtuemart.startVmLoading).on('click', {msg:msg}, Virtuemart.startVmLoading);$('[data-dynamic-update=\"1\"]').off('change', Virtuemart.startVmLoading).on('change', {msg:msg}, Virtuemart.startVmLoading);var productCustomization=$('.cd-customization'),cart=$('.cd-cart'),animating=false;initCustomization(productCustomization);$('body').on('click',function(event){if($(event.target).is('body')||$(event.target).is('.cd-gallery')){deactivateCustomization()}});function initCustomization(items){items.each(function(){var actual=$(this),addToCartBtn=actual.find('.add-to-cart'),touchSettings=actual.next('.cd-customization-trigger');addToCartBtn.on('click',function(){if(!animating){animating=true;resetCustomization(addToCartBtn);addToCartBtn.addClass('is-added').find('path').eq(0).animate({'stroke-dashoffset':0},300,function(){setTimeout(function(){updateCart();addToCartBtn.removeClass('is-added').find('.addtocart-button').on('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend',function(){addToCartBtn.find('path').eq(0).css('stroke-dashoffset','19.79');animating=false});if($('.no-csstransitions').length>0){addToCartBtn.find('path').eq(0).css('stroke-dashoffset','19.79');animating=false}},600)})}});touchSettings.on('click',function(event){event.preventDefault();resetCustomization(addToCartBtn)})})}function resetCustomization(selectOptions){selectOptions.siblings('[data-type=\"select\"]').removeClass('is-open').end().parents('.cd-single-item').addClass('hover').parent('li').siblings('li').find('.cd-single-item').removeClass('hover').end().find('[data-type=\"select\"]').removeClass('is-open')}function deactivateCustomization(){productCustomization.parent('.cd-single-item').removeClass('hover').end().find('[data-type=\"select\"]').removeClass('is-open')}function updateCart(){(!cart.find('.total_products').hasClass('items-added'))&&cart.find('.total_products').addClass('items-added').removeClass('empty_basket');var cartItems=cart.find('span'),text=parseInt(cartItems.text())+1;cartItems.text(text)}});"; vmJsApi::addJScript('vmPreloader',$j); } echo vmJsApi::writeJS(); if ($this->product->prices['salesPrice'] > 0) { echo shopFunctionsF::renderVmSubLayout('snippets',array('product'=>$this->product, 'currency'=>$this->currency, 'showRating'=>$this->showRating)); } ?> </div>
Similar TutorialsI've added a download button to all of my posts using custom fields in wordpress. I know there is an easier way just not sure how. Right now I have to add the custom field on each post, instead I'd like to just have a download button (with css) automatically on all posts (download button will be going to the same url on each post). My current code Code: [Select] <div id="downloadbutton"> <?php if(get_post_meta($post->ID, "download_link", $single = true) != ""){ ?> <a href="<?php echo get_post_meta($post->ID, "download_link", $single = true); ?>"<img src="http://www.MYSITE.com/images/downloadbutton.png" border="0"></a> <?php } ?> </div> Appreciate the help! This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=317600.0 Hi I've been scouring the net and I cant find anything that works. Can someone tell me how to put a delete button next to each record? Any help is appreciated, thank you! Code: [Select] $term = strtolower ($_POST['term']); $sql = mysql_query("select * from $table where first like '%$term%' or last like '%$term%'"); while ($row = mysql_fetch_array($sql)){ echo 'ID: '.$row['id']; echo '<br/> first: '.$row['first']; echo '<br/> last: '.$row['last']; echo '<br/> phone: '.$row['phone']; echo '<br/> mobile: '.$row['mobile']; echo '<br/> fax: '.$row['fax']; echo '<br/> email: '.$row['email']; echo '<br/> web: '.$row['web']; echo '<br/><br/>'; } ?> </p> Is it possible adding a button with PHP, which could be used for adding an optional text input field by client side user? My purpose is actually very simple: The client side users could be free creating and adding more and customized variables, which are intended to be used as strings and related or associated variables. So, am I able to do these kind of tasks simply using PHP alone? Or, should I use some JavaScript like technologies to make those functions available in real world's practices? Hello, I have the following function function make_agent_drop($dropname,$parent=''){ $agents = mysql_query("SELECT * FROM ad_category WHERE cat_status='1' AND parent_id='".(is_numeric($parent)?$parent:"0")."'") or die(mysql_error()); $anum = mysql_num_rows($agents); if($anum>0){ $agentdrop='<select style="width:150px; height:20px; margin-left:100px; font-size:11px;" name="'.$dropname.'" id="'.$dropname.'" class="text" '.(is_numeric($parent)?'':'onchange="update_subcatdrop($(this).val());').'"> <option value="0">Select a Category</option>'; while($row= mysql_fetch_array($agents)){ $agentdrop.='<option value="'.$row['cat_id'].'">'.$row['cat_name'].'</option>'; } $agentdrop.='</select>'; }else{ $agentdrop= 'No '.(is_numeric($parent)?'Sub':'').'Categories Found.'; } return $agentdrop; ; } I creates a drop down from database cats and sub cats.. I am trying to figure out how to add a submit button to dynamically appear when it displays the sub category... Thanks! Dan Friends I am new to php and i have to submit my coursework in php by 3rd dec, I stuck at one place where i have to upload multiple photo and one can see all the photo he has uploaded and can edit or delete that photo so i have done uploading now i am showing those pics in table by running loop and generating tr and td but now i have two buttons with each row edit and delete now when i clicked on one delete or edit that pic should be delete or give text box to edit description of pic, Please help me how to do that....... If you look at this form: kmkwebdevelopment.com/formtest/upload.php you will see that when you click on the "add another upload box" button, instead of it adding another upload box, it is submitting the form for some reason. Can anyone see where the error lies? Relevant snippet of code below: <?php //deafult number of upload boxes $upload_quant = 4; //if the user increased the number of boxes if(isset($_POST['increase_upload'])) { //increasing the number of upload boxes $upload_quant = $_POST['previous_upload'] + 1; } $upload_quantity = $_POST['previous_upload']; //getting all the names into an array $uplaoded_array = array(); for($i=0;$i<$upload_quantity;++$i) { $ii = $i+1; $upload_name = 'upload'.$ii; $get_upload_name = $_POST['$upload_name']; array_push($uplaoded_array,$get_upload_name); } ?> <form class="uploadform" action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post" enctype="multipart/form-data" onSubmit="return CheckForm(this);"> <?php IsThereErrors("0", $_iserrors); ?> <input type="hidden" name="_referer" value="<?php echo $_referer ?>"> <input type="hidden" name="_next_page" value="1"> <p class="form_expert_style"><input name="URL" type="text" value=""/></p> <table> <tr> <td>First Name *</td> <td><input type='text' size='30' name='firstname' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("firstname", "") ?> value="<?php echo isset($_values["firstname"]) ? htmlspecialchars($_values["firstname"]) : "" ?>"></td> </tr> <tr> <td>Last Name *</td> <td><input type='text' size='30' name='lastname' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("lastname", "") ?> value="<?php echo isset($_values["lastname"]) ? htmlspecialchars($_values["lastname"]) : "" ?>"></td> </tr> <tr> <td>E-mail *</td> <td><input type='text' size='30' name='email' onblur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("email", "") ?> value="<?php echo isset($_values["email"]) ? htmlspecialchars($_values["email"]) : "" ?>"></td> </tr> <tr> <td>Company Number *</td> <td><input type='text' size='30' name='companynumber' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("companynumber", "") ?> value="<?php echo isset($_values["companynumber"]) ? htmlspecialchars($_values["companynumber"]) : "" ?>"></td> </tr> <?php for($i=0;$i<$upload_quant;++$i) { $ii = $i+1; $upload_name = 'upload'.$ii; echo <<<_END <tr> <td>Upload $ii</td> <td><input class="image" type='file' size='30' name='$upload_name'></td> </tr> _END; } echo <<<_END <tr> <td> <input type="hidden" value="$upload_quant" name = "previous_upload"/> <input type="submit" name="increase_upload" value="Add another upload box" /> </td> <tr> <td><input type="submit" name="SubmitBtn" onClick="CheckForm1();" value="SUBMIT" /></td> </tr> </table> </form> _END; } ?> </html> <?php Thanks the info posts beautifully i just canst seem to get the button to auto click or submit, tried numerous ways! help Code: [Select] <?php require_once "../store/paypal/utility.php"; require_once "../store/paypal/constants.php"; $url = "https://www.".DEFAULT_ENV.".paypal.com/cgi-bin/webscr"; $postFields = "cmd=".urlencode("_notify-synch"). "&tx=".urlencode(htmlspecialchars($_GET["tx"])). "&at=".urlencode(DEFAULT_IDENTITY_TOKEN); $ppResponseAr = Utils::PPHttpPost($url, $postFields, true); if(!$ppResponseAr["status"]) { Utils::PPError($ppResponseAr["error_msg"], $ppResponseAr["error_no"]); exit; } $httpParsedResponseAr = $ppResponseAr["httpParsedResponseAr"]; // assign posted variables to local variables $item_name = $httpParsedResponseAr['item_name']; $item_number = $httpParsedResponseAr['item_number']; $receiver_email = $httpParsedResponseAr['receiver_email']; $receiver_id = $httpParsedResponseAr['receiver_id']; $quantity = $httpParsedResponseAr['quantity']; $first_name = $httpParsedResponseAr['first_name']; $last_name = $httpParsedResponseAr['last_name']; $payer_email = $httpParsedResponseAr['payer_email']; $txn_type = $httpParsedResponseAr['txn_type']; $address_street = $httpParsedResponseAr['address_street']; $address_city = $httpParsedResponseAr['address_city']; $address_state = $httpParsedResponseAr['address_state']; $address_zip = $httpParsedResponseAr['address_zip']; $item_number = $httpParsedResponseAr['item_number']; $option_name1 = $httpParsedResponseAr['option_name1']; $option_selection1 = $httpParsedResponseAr['option_selection1']; $option_name2 = $httpParsedResponseAr['option_name2']; $option_selection2 = $httpParsedResponseAr['option_selection2']; $invoice = $httpParsedResponseAr['invoice']; $custom = $httpParsedResponseAr['custom']; $payer_id =$httpParsedResponseAr['payer_id']; ?> <html lang="en"> <head> <title>Rec</title> <link REL="stylesheet" href="include/style.css" type="text/css"> <!--[if IE]> <link REL="stylesheet" href="include/styleIE.css" type="text/css"> <![endif]--> <style> #center_block {width:50%;margin:0 auto;min-width:500px;} #contents_block {text-align:center;} #header_block {white-space:nowrap;height:25px;padding:0 10px 5px;text-align:center;} #fields_block {width:100%;margin:0;padding:10px} #header_block span {margin:0 5px} #buttons_block {padding:10px 10px 5px} #buttons_block div {padding:3px} #delimiter {margin:2px} #fields_block td {padding:3px 14px} #username_block td {padding-top:13px;white-space:nowrap;} #remember_block td {padding-bottom:13px;white-space:nowrap;} #required_block {text-align:left;padding:5px} </style> <!--[if IE]> <style> #main_block {width:100%} </style> <![endif]--> </head> <body> <script language="JavaScript" src="include/jquery.js"></script> <script language="JavaScript" src="include/jsfunctions.js"></script> <script language="JavaScript" src="include/runnerJS/RunnerBase.js"></script> <form action="rec.php" method="post" id="rec" name="rec.php"> <table id="center_block" align="center"> <tr><td id="contents_block"> <div class="main_table_border2 loginshade" id="main_block"> <table cellpadding=0 cellspacing=0 border=0 id="fields_block" class="loginshade"> <tr id="email_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_email_1">Email:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_email_0" style="white-space: nowrap;"><input id="value_email_1" style="" type="text" name="value_email_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["payer_email"]) ?>"> <font color="red">*</font></span> <div class="error"></div> </td> </tr> <tr id="pass_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_pass_1">Pass:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_pass_0" style=""><input style="" id="value_pass_1" type="Password" name="value_pass_1" maxlength=50 value="1234"> <font color="red">*</font></span> <div class="error"></div> </td> </tr> <tr id="confirm_block"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_confirm_1">Re-enter password:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_confirm_0" style=""><input style="" id="value_confirm_1" type="Password" name="value_confirm_1" value="1234"> <font color="red">*</font></span> <div class="error"></div> </td> </tr> <tr id="fname_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_fname_1">First Name:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_fname_0" style="white-space: nowrap;"><input id="value_fname_1" style="" type="text" name="value_fname_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["first_name"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="lname_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_lname_1">Last Name:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_lname_0" style="white-space: nowrap;"><input id="value_lname_1" style="" type="text" name="value_lname_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["last_name"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="address_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_address_1">Address:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_address_0" style="white-space: nowrap;"><input id="value_address_1" style="" type="text" name="value_address_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["address_street"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="city_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_city_1">City:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_city_0" style="white-space: nowrap;"><input id="value_city_1" style="" type="text" name="value_city_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["address_city"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="state_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_state_1">State:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_state_0" style="white-space: nowrap;"><input id="value_state_1" style="" type="text" name="value_state_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["address_state"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="zip_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_zip_1">Zip:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_zip_0" style="white-space: nowrap;"><input id="value_zip_1" style="" type="text" name="value_zip_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["address_zip"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="cosponsor_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_cosponsor_1">Cosponsor:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_cosponsor_0" style=""><input id="type_cosponsor_1" type="hidden" name="type_cosponsor_1" value="checkbox"><input id="value_cosponsor_1" type="Checkbox" name="value_cosponsor_1" ></span> </td> </tr> <tr id="recipients_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_recipients_1">Recipients:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_recipients_0" style="white-space: nowrap;"><input id="value_recipients_1" style="" type="text" name="value_recipients_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["quantity"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="clients_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_clients_1">Clients:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_clients_0" style=""><input id="type_clients_1" type="hidden" name="type_clients_1" value="checkbox"><input id="value_clients_1" type="Checkbox" name="value_clients_1" ></span> </td> </tr> <tr id="space_block"></tr> </table> </div> </td></tr> </table> <input type=submit value="Submit" class=button id="saveButton1" onload="Submit"></form> </body> </html> How can i add a facebook "like" button on every news on my website, my news are going by id, and how can i make that to work when click on like for that news? Hi, I currently have an HTML form that posts data (method:POST) to a PHP script. The PHP script then retrieves the data and displays it on screen so the user can do a final check. I then want to have a button, so that when pressed, the data gets sent to a MySQL database. What I have so far is along these lines: Code: [Select] <?php if(isset($_POST['var1'])) {$var1 = $_POST['var1'];} else {$var1 = "";} if(isset($_POST['var2'])) {$var2 = $_POST['var2'];} else {$var2 = "";} echo "<b>You have entered the following:</b><p></p>", "$var1 <br>","$var2<p></p>", "If this is correct, please press continue."; print "<html><body><button name=Button1 onclick="">Continue</button></body></html>"; and onclick I want the following to run: Code: [Select] $link = mysql_connect ('localhost', 'root'); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db ('DB1', $link); mysql_query ("INSERT INTO table1 (field1, field2) VALUES ('$var1','$var2')"); mysql_close($link); How can I do this?! Is it neccesary to use another "submit" button that submits $var1 & $var2 to a different PHP script, which then runs the mysql_connect part? Or can I enclose the mysql_connect part in an IF statement that runs only if Button1 has been pressed (and I enclose the rest of the PHP script in an IF statement that runs only if Button1 has NOT been pressed) and get Button1 to reload the same PHP script? Either way, how do I define an onclick event inside echo? This prob a noobish question, but I seem to get errors if I try to put (single) quotes "" ' ' inside the quotes of the echo: echo " onclick"" "; Thanks! What am I doing wrong with this selected radio button? <form action="Process/privacy.php" method="post" enctype="multipart/form-data" id="privacy"> <div id="privacy_vis">Your profile is visible to:</div> <div id="privacy_select"> <label> <input name="RadioGroup1" type="radio" id="RadioGroup1_0" value="1" <?if($visible=="1")echo 'checked="checked"';?> /> Everyone</label> <label> <input name="RadioGroup1" type="radio" id="RadioGroup1_1" value="0"/> Members Only</label> </div> <br /> <div id="privacy_vis">Your Password to view your private pictures is:</div> <div> <input name="pictures_pw" type="text" id="pictures_pw" value="<? echo "$xxx_pw" ?>" size="50" maxlength="20" /> </div> <br /> <div> <input name="submit" type="submit" class="button" id="submit" value="Save Changes" /> </div> </form> </div> hi all here is my code... Code: [Select] <?php echo "<input name="."button"." type="."submit"." class="."formbutton"." id="."button"." value="."Submit 1"." />"; ?> problem is, i want to display the value of button is Submit space 1 like "Submit 1", but it is display only "Submit" value and blank space and 1 are not display.. someone help me please.... thanks shahid hussnain heres the line for my button Code: [Select] echo "<tr><td colspan='2'><input type='submit' value='Add Reply' onClick=\"window.location = post_reply.php?cid=".$cid."&tid=".$tid."\" /><hr /> "; for some reason when i click on it in the site it does not do anything, but when i type the link in maunaly that the button should link to the page works. heres the code for the page that the button is on Code: [Select] <?php require("top.php"); ?> <div id='content'> <div id='homepageright'> <?php require("scripts/connect.php"); if($username){ $cid = intval($_GET['cid']); $tid = intval($_GET['tid']); $sql = "SELECT * FROM topics WHERE category_id = $cid AND id = $tid"; $res = mysql_query($sql) or die(mysql_error()); /*$cid = $_GET['cid']; $tid = $_GET['tid']; $sql = "SELECT * FROM topics WHERE category_id='".$cid."' AND id='".$tid."'"; $res = mysql_query($sql) or die(mysql_error());*/ if(mysql_num_rows($res) == 1){ echo "<table width='100%'>"; if($username){ echo "<tr><td colspan='2'><input type='submit' value='Add Reply' onClick=\"window.location = post_reply.php?cid=".$cid."&tid=".$tid."\" /><hr /> "; } While ($row = mysql_fetch_assoc($res)) { $sql2 = "SELECT * FROM post WHERE category_id='".$cid."' AND topic_id= '".$tid."'"; $res2 = mysql_query($sql2) or die(mysql_error()); while ($row2 = mysql_fetch_assoc($res2)) { echo "<tr><td valign='top' style='border: 1px solid #000000;'><div style='min-height: 125px; '>".$row['topic_title']."<br /> by ".$row2['post_creator']." - ".$row2['post_date']. "<hr /> ".$row2['post_content']."</div></td><td width='200' valign='top' align='center' style='border: 1px solid #000000;'>User Info Here</td></tr><tr><td colspan='2'><hr /></td></tr>"; } echo "</table>"; } } else{ echo "This Topic Does Not Exist."; echo "$sql"; } } else{ echo "You Must Be Logged In To Continue."; } ?> </div> <div id='homepageleft'> <?php ?> </div> </html> </body> Hello everyone. Newbie question. I have a page that pulls listings from a database by letter (a,b,c, etc) , but I would like to have a Next button, that would take people to the next letter, but can't figure out how to make that happen. I understand doing that with numbers and using the +1 for the next page, but how do you code a next button to search for the next letter? Any help would be VERY appreciated. I have a function to display some images and allow a user to select a choice via a radio button.The value is then passed to another function. I have 2 problems My selection is not being passed back and I cant assign the value to a query sring in a link to another page. On the form do i need to add checked? Any help appreciated. Code: [Select] function cover() { echo'<h2>Please upload your book cover or choose one from the selection</h2> <p>All book ideas require a cover. Your choice can be changed at a later date.</p>'; //process selection of cover if (isset($_POST['submit'])) { $coverID=$_POST['cover']; echo $coverID; ?>   <ul><li class="demo-menu-link"><a href="?page=submenu7&coverID=$coverID">Finnished Cover</a></li></ul><?php exit(); } else{ echo "not Submitted"; } global $wpdb; $query = "select * from wp_cover"; $result = mysql_query($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error()); echo mysql_error(); if (!$result){ return false; } echo'<div class="wrap"><p>choose from one of the covers below</p></div>'; ?><form action="<?php $_SERVER['PHP_SELF'] ?>" method="POST" id="cover" enctype="multipart/form-data"> <table><tr><?php /* display picture and radio button */ while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $coverID=$row['coverID']; echo"<img src=\"/wordpress_3/wp-content/plugins/Authors2/jackets/{$row['pix']}\" />"; echo"<td>"; echo $coverID; echo "<Input type = 'Radio' Name ='cover' value= '$coverID'/>"; ?> </tr></table> <input type=submit value=submit> </form><?php } } ok i want admin to click on the edit button and a form shows up where you can edit your events and stuff like that but i cant get the edit button to work Code: [Select] <?php require 'scripts/connect.php'; echo " <table width='472' border='0'> <tr> <th width='43' height='21' scope='col'>Event Id</th> <th width='116' scope='col'>Event Nane</th> <th width='106' scope='col'>Event Type</th> <th width='63' scope='col'>EDIT</th> <th width='63' scope='col'>DELETE</th> </tr> </table>"; $sqlCommand = "SELECT * FROM events"; $out = mysql_query($sqlCommand); while ($row = mysql_fetch_assoc($out)){ $eventid = $row["id"]; $eventname = $row["eventname"]; $eventtype = $row["typeevent"]; $eventinfo = $row["eventinfo"]; $date = $row["date"]; $time = $row["time"]; $livetickets = $row["sale"]; $numtickets = $row["numtickets"]; $pricestudents = $row["studentsprice"]; $priceseniors = $row["seniorsprice"]; $priceadults = $row["adultsprice"]; if ($_POST['editbtn']){ echo "<form action='editevent' method='post'> <table> <tr> <td>Event Name</td> <td></td> <tr> <tr> <td></td> <td></td> <tr> <tr> <td></td> <td></td> <tr> </table> </form> "; }else echo" <table width='472' border='0'> <tr><form action='editevent.php' method='post'> <th width='59' height='21' scope='col'>$eventid</th> <th width='159' scope='col'>$eventname</th> <th width='151' scope='col'>$eventtype</th> <th width='85' scope='col'><input type='button' name='editbtn' value='Edit' /></th> <th width='85' scope='col'><input type='button' name='deletebtn' value='Delete' /></th> </form></tr> </table>"; } ?> Hello. I decided to create my own browser game and started learning PHP and HTML. Everything is going quite well now I'm creating a primitive version of the game. I'm reading tutorials and moving forward fast. But I started thinking about the combat system and got stuck. I want to let my users to choose which monster to attack with buttons. I made this form as an example: <p>Choose which monster you want to hunt:</p> Rat<br /> <form action='main.php?p=hunt' method='post'> <input type='submit' name='rat' value='Attack' /><br /><br /> Slime<br /> <form action='main.php?p=hunt' method='post'> <input type='submit' name='slime' value='Attack' /> </form> And I'd like to know what code should I use to know which submit button was pressed, the rat or slime one. I currently only know how to do a lot of IF's to determine it so is there a short way to do it? If anyone can, please help me, and if you can try to explain it simply as I'm still starting to understand php . And also I'd like some suggestions where to run my combat script (the same page where the form is or it should be on a different page, if the page should use id from a rand() function and so on). Thanks This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=308101.0 hi again, having trouble getting the result from the drop down box to direct to another page the if statement works when i don't try and do anything with it. should the IF statement go on another page and the submit button POST the $result, i'm really not sure. any help would be great.. code so far index.php <?php $query = "SELECT * FROM `ride` ORDER BY name"; $result = mysql_query($query); echo"<select name='name'><option value=''>Select Ride</option>"; while( $row = mysql_fetch_array($result) ) { echo '<option>'.$row['name'].'</option>'; } echo '</select>'; mysql_free_result( $result ); //// do rest of form when done///// echo "<form method=post name=f1 action='dd-check.php'>"; echo "<input type=submit value=Submit>"; echo "</form>"; ?> dd-check.php <?php $result =$_POST['WHAT GOES HERE?']; <-----------???? is this even needed? echo "Ride Choosen = $result"; <-----------???? how do i get the $result from index.php? if ($result == "Swinging Ship") { header('Location: Swing.php'); } elseif ($result == "Roller Coaster") { header('Location: Roller.php'); } elseif ($result == "Ice Blast") { header('Location: Ice.php'); } else { echo "choose a ride"; } ?> |