slawrence10 Posted October 21, 2009 Share Posted October 21, 2009 Hey if you have a look at this... http://www.attleboroughtown.co.uk/kwtables/index.php?route=product/product&product_id=49 And click the check button it reloads the page fine. But when uploading the site to my other server it comes up with a blank page... http://www.kwtables.com/index.php?route=product/product&product_id=49 Any ideas why this might be? In the form action I'm using <form action="<?php echo $_SERVER['PHP_SELF'].'?route=product/product&product_id='.$product_id; ?>" enctype="multipart/form-data" method="post" name="check"> Your time is much appreciated, Kind Regards, Scott Lawrence Quote Link to comment https://forums.phpfreaks.com/topic/178405-php-form-action-selfnot-working-on-one-server/ Share on other sites More sharing options...
mikesta707 Posted October 21, 2009 Share Posted October 21, 2009 if you don't set an action, it will automatically submit to itself. You can use this instead Quote Link to comment https://forums.phpfreaks.com/topic/178405-php-form-action-selfnot-working-on-one-server/#findComment-940800 Share on other sites More sharing options...
slawrence10 Posted October 21, 2009 Author Share Posted October 21, 2009 Hey Mike, I just removed the action from kwtables.com server and still just doen't load anything :/ Any more ideas? Regards, Scott Quote Link to comment https://forums.phpfreaks.com/topic/178405-php-form-action-selfnot-working-on-one-server/#findComment-940801 Share on other sites More sharing options...
slawrence10 Posted October 21, 2009 Author Share Posted October 21, 2009 Could it be due to different php configurations? http://www.attleboroughtown.co.uk/kwtables/info.php and http://www.kwtables.com/info.php Quote Link to comment https://forums.phpfreaks.com/topic/178405-php-form-action-selfnot-working-on-one-server/#findComment-940805 Share on other sites More sharing options...
mikesta707 Posted October 21, 2009 Share Posted October 21, 2009 hmm blank page? can I see the code for the processing page? Quote Link to comment https://forums.phpfreaks.com/topic/178405-php-form-action-selfnot-working-on-one-server/#findComment-940810 Share on other sites More sharing options...
slawrence10 Posted October 21, 2009 Author Share Posted October 21, 2009 Hey Mike If you try now it shows some of the content (the product.tpl part) but not the rest of the page layout...it's as if it isn't calling to the correct place for all the template files. So I don't think it is to do with the actual form submition. Here are the contents of product.tpl not sure it will be much use to you though <?php require_once('Connections/KWconnectHOME.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_KWconnect, $KWconnect); $query_address = "SELECT * FROM kwOCproduct_address WHERE product_id =".$product_id.""; $address = mysql_query($query_address, $KWconnect) or die(mysql_error()); $row_address = mysql_fetch_assoc($address); $totalRows_address = mysql_num_rows($address); ?> <div class="top"> <h1><?php echo $heading_title; ?> <?php if ($average) { ?> <img src="catalog/view/theme/default/image/large_stars_<?php echo $average . '.png'; ?>" alt="<?php echo $text_stars; ?>" style="margin-top: 2px;" /> <?php } ?> </h1> </div> <!-- MY INSERT --> <style type="text/css"> .wrap{ width:590px; overflow:hidden; display:block; }.leftbar{ width:368px; float:left; }.rightbar{ width:222px; float:right; color:#3B3A35; }.rightbar p{ padding-left:30px; }.contact{ padding:10px; background-color:#EAEAEA; width:348px; display:block; height:110px; }.left{ float:left; width:174px; overflow:visible; }.right{ float:right; width:174px; text-align:right; overflow:visible; }.description{ width:348px; text-align:left; background-color:#FFF; } </style> <div class="wrap"> <div class="leftbar"> <a href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>" class="thickbox"><img src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" id="image"/ width="368px" height="368px"></a><div class="contact"> <div class="left"> <?php echo $heading_title; ?><br> <?=$row_address['street1']?><br> <?=$row_address['street2']?><br> <?=$row_address['street3']?><br> <?=$row_address['town']?><br> <?=$row_address['postcode']?><br /> </div> <div class="right"><b>tel</b> <?=$row_address['telephone']?><br /><br /><br /><br /><br /> <b>web</b> <?=$row_address['website']?> </div> </div> <div style="padding-top:10px; padding-left:10px;"> <img src="image/restaurant_descritpion.gif" alt="Restaurant Description" /> <?php echo $description; ?> </div> </div> <div class="rightbar"> <br /> <p><?php echo $price ?> Standard Table</p> <h2 style="margin-bottom:10px;"><img src="image/check_availability.gif" alt="Check Availability" /></h2> <p> <?php echo $_SERVER['PHP_SELF'] ?> <form action="/index.php?route=product/product&product_id=<?=$product_id; ?>" enctype="multipart/form-data" method="post" name="check"> <?php if(isset($_POST['check'])){ ?> <select name="timename"> <?php if($_POST['timename']=='1'){ ?> <!--<option value="1" selected="selected">Lunch</option>--> <option value="2">Dinner</option> <?php }else{ ?> <!--<option value="1">Lunch</option>--> <option value="2" selected="selected">Dinner</option> <?php } ?> </select> <input name="date" type="text" class="date" size="12" value="<?php echo $_POST['date']; ?>"/><br /> <input name="check2" type="submit" value="check" /> </form> <?php } else { ?> <select name="timename"> <!--<option value="1">Lunch</option>--> <option value="2">Dinner</option> </select><br /> <input name="date" type="text" class="date" size="12" /><br /> <input name="check" type="submit" value="check" /> </form> <?php } ?> </p> <h2 style="margin-bottom:10px;" /><img src="image/availability_results.gif" alt="Availability Results"></h2> <p> <?php if(isset($_POST['check'])){ $thedate = $_POST['date']; $datetime = date_create($_POST['date']); $whichday = strtolower(date_format($datetime, 'D')); echo date_format($datetime, 'l d F Y').' - '; if(isset($_POST['timename'])){ if($_POST['timename'] == '1'){ echo 'Lunch'; } else { echo 'Dinner'; } } ?> </p> <?php $i='0'; ?> <?php foreach ($options as $option) { ?> <?php foreach ($option['option_value'] as $option_value) { ?> <?php if($option_value['private']==1){ $border='E0D507'; $bg='FFFF8A'; $backg='images/private_icon.gif'; }else{ $border='39B54A'; $bg='FFFFFF'; $backg=''; } $i++; ?> <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="product<?php echo $i; ?>"> <div style="border:#<?php echo $border; ?> 1px solid; height:52px; width:175px; margin-left:20px; margin-bottom:10px; padding:4px; padding display:block; background-repeat:no-repeat; background-position:top right; background-image:url('<?php echo $backg;?>'); background-color:#<?php echo $bg; ?>;"> <B>Table <?php echo $option['name']; ?></b> <font size="-1"><?php echo $option_value['hour']; ?></font>:<font size="-1"><?php echo $option_value['min']; ?></font><br /> <?php echo $option_value['totalbooked']; ?> of <?php echo $option_value[$whichday]; ?> seats booked<br /> <a onclick="$('#product<?php echo $i ?>').submit();" id="add_to_cart" class="button" style="float:right;"><span>Book a Seat</span></a> </div> <input type="hidden" name="option[<?php echo $option['option_id']; ?>]" value="<?php echo $option_value['option_value_id']; ?>" /> <input type="hidden" name="product_id" value="<?php echo $product_id; ?>" /> <input type="hidden" name="date" value="<?php echo date_format($datetime, 'l d F Y'); ?>" /> <input type="hidden" name="txtoption[date]" value="<?php echo date_format($datetime, 'Y-m-d'); ?>" /> <input type="hidden" name="tableid" value="<?php echo $option_value['option_value_id']; ?>" /> <input type="hidden" name="quantity" value="1" /> </form> <?php } } }else{ echo '...make a search above'; } ?> <h2 style="margin-bottom:10px; margin-top:15px;" /><img src="image/related_restaurants.gif" alt="Related Restaurants" /></h2> <p>Related restaurant One</p> <p>Related restaurant Two</p> </div> </div> <!-- INSERT END --> <?php // print_r($_SESSION); ?> <div class="bottom"> </div> <script type="text/javascript"><!-- $('#review .pagination a').live('click', function() { $('#review').slideUp('slow'); $('#review').load(this.href); $('#review').slideDown('slow'); return false; }); $('#review').load('index.php?route=product/product/review&product_id=<?php echo $product_id; ?>'); function review() { $.ajax({ type: 'post', url: 'index.php?route=product/product/write&product_id=<?php echo $product_id; ?>', dataType: 'json', data: 'name=' + encodeURIComponent($('input[name=\'name\']').val()) + '&text=' + encodeURIComponent($('textarea[name=\'text\']').val()) + '&rating=' + encodeURIComponent($('input[name=\'rating\']:checked').val() ? $('input[name=\'rating\']:checked').val() : '') + '&captcha=' + encodeURIComponent($('input[name=\'captcha\']').val()), beforeSend: function() { $('.success, .warning').remove(); $('#review_button').attr('disabled', 'disabled'); $('#review_title').after('<div class="wait"><img src="catalog/view/theme/default/image/loading_1.gif" alt="" /> <?php echo $text_wait; ?></div>'); }, complete: function() { $('#review_button').attr('disabled', ''); $('.wait').remove(); }, success: function(data) { if (data.error) { $('#review_title').after('<div class="warning">' + data.error + '</div>'); } if (data.success) { $('#review_title').after('<div class="success">' + data.success + '</div>'); $('input[name=\'name\']').val(''); $('textarea[name=\'text\']').val(''); $('input[name=\'rating\']:checked').attr('checked', ''); $('input[name=\'captcha\']').val(''); } } }); } //--></script> <script type="text/javascript"><!-- $.tabs('.tabs a'); //--></script> <link rel="stylesheet" type="text/css" href="<?php echo HTTP_SERVER; ?>admin/view/stylesheet/datepicker.css" /> <script type="text/javascript" src="<?php echo HTTP_SERVER; ?>admin/view/javascript/jquery/ui/ui.core.min.js"></script> <script type="text/javascript" src="<?php echo HTTP_SERVER; ?>admin/view/javascript/jquery/ui/ui.datepicker.min.js"></script> <script type="text/javascript"><!-- $(document).ready(function() { $('.date').datepicker({ dateFormat: 'yy-mm-dd', minDate: '0', maxDate: '+365' }); }); //--></script> Thanks for your help with this! Kind Regards, Scott Quote Link to comment https://forums.phpfreaks.com/topic/178405-php-form-action-selfnot-working-on-one-server/#findComment-940813 Share on other sites More sharing options...
slawrence10 Posted October 21, 2009 Author Share Posted October 21, 2009 Also I'm using the OpenCart framework but I've heavily modified it for restaurant booking. Weird that it works on one server but not the other :/ Quote Link to comment https://forums.phpfreaks.com/topic/178405-php-form-action-selfnot-working-on-one-server/#findComment-940814 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.