Posts

Showing posts with the label PHP

Hide form with php on submit?

Move the  " ; } if ( isset ( $_POST )) ?> And the form in the body: id = "wrap" > method = "POST" action = "secure.php" > User type = "text" name = "user" > Pass type = "text" name = "pass" > type = "submit" name = "submit" value = "access page" >

Re: Cannot upload images - warning directory does not exist

In my case the sulution was: It appeared that in both config.php files (in root and admin dirctories) all the entries (including /image) were: /..../...../provider-name/user-name/domain-name/htdocs//image/') - meaning two // instead of one /. Possibly it is the bug in the OpenCart installation script. I've changed ALL // to / in both files. Now it works fine.

OpenCart 2.x. How to manage sidebars

Image
Access OpenCart admin panel, go to  System menu -> Design -> Layouts   tab  to add/delete  sidebar  box. The  Layout   tab  offers variety of pages to which you can assign existing positions. Select the  layout  you would like to edit, for example the  Contact  Layout . Click the  Edit icon  next to it to start customization: In order to add a new  module , click the  “+”  icon under the  Module /Position/Sort Order   tab . Select  Module  under  Modules  column, assign position using the  Position  drop-down menu and set  module  order in the  Sort Order  column: To delete modules from  sidebar  or any other position, click the  “-“  icon. Make sure to save the changes with the  Save icon  in the top right corner. In case the  sidebar  is missing on the page, you can create one by s...

Warning: You do not have permission to access the API! OC2

Make sure you have applied all Access and Modify permissions to your user group. To do this, go to: Admin CP > System > Users > User Groups > Administrator [edit] > Select all Access and Permissions and click save.
before opencart 2.2 version if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/category_' . $category_id . '.tpl')) { $this->template = $this->config->get('config_template') . '/template/product/category_' . $category_id . '.tpl'; } elseif (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/category.tpl')) { $this->template = $this->config->get('config_template') . '/template/product/category.tpl'; } else { $this->template = 'default/template/product/category.tpl'; } opencart 2.2 version onwards Since Opencart changed its method from 2.2 that code doesn't work anymore, you can modify it like this: First we must know which theme is active, store its name in a variable $config_theme = $this->config->get('config_theme') == 'theme_default' ? 'd...

PHP Echo text Color

echo '

How to use single quote inside an echo which is using single quote

<?php  echo 'Here goes your message with an apostrophe S like thi\'s' ; ?>

PHP - Hiding a Form after a Submit

<?php include ('database_connection.php'); $DisplayForm=True; if (isset($_POST['submit'])) { $DisplayForm=False; } <?php  if ($DisplayForm) ?> <form> <input type="text" name="name"> <input type="submit" name="submit"> </form> <?php } ?> https://www.youtube.com/watch?v=v4p8Pu0MDBY

Show/Hide Div Based on URL (PHP)

if ( strpos ( $_SERVER [ 'REQUEST_URI' ], "index.php" ) >= 0 ) { $left_col_class = "showme" ; } else { $left_col_class = "hideme" ; } // Your html... < div id = 'left_col' class = '<?php echo $left_col_class; ?>' > contents </ div > // Your CSS . hideme { display : none ; } . showme { display : block ; }

PHP Code for Go Back Button

<input type="submit" <a href = "#" onclick = " history . back (); " > "Back" </a> or <input onclick="history.back();" class="btn btn-danger pull-left next action-button center-block bold" value="Edit Order" />  

PHP MySQL After data insert send Email

Image
insert.php <form method="post" action="submitinsert.php"> name<input type="text" name="name"><br> email<input type="email" name="email"><br> <input type="submit" name="submit" value="submit"> </form> submitinsert.php <?php $servername="localhost"; $username="root"; $password=""; $database="okmam"; //create connection$ $conn=new mysqli($servername, $username, $password, $database); //check connection if ($conn->connect_error) {     die("connection failed: ".$conn->connect_error); } ?> <?php $name=$_POST['name']; $email=$_POST['email']; if (!$conn) {     die("Connection failed: " . mysqli_connect_error()); } $sql = "INSERT INTO inserttest (name, email) VALUES ('$name', '$email')"; if (mysqli_query(...