Jump to content

MadTechie

Staff Alumni
  • Content Count

    9,409
  • Joined

  • Last visited

  • Days Won

    1

MadTechie last won the day on April 12

MadTechie had the most liked content!

Community Reputation

1 Neutral

About MadTechie

  • Rank
    Prolific Member
  • Birthday 07/03/1978

Profile Information

  • Gender
    Male
  • Location
    UK
  1. While I like @Barand approach, and YES I know this is a basic script, it would be kinda easy to cheat ☺️ However, it does suit your assignment better.
  2. Hi DaveMag First off, please use the <> script button for pasting code, it really does help, Like so <?php $cat=$_REQUEST['cat']; ?> <SCRIPT language=JavaScript> <!-- function reload(form) { var val=form.cat.options[form.cat.options.selectedIndex].value; self.location='reports.php?cat=' + val ; } </script> <?Php ///////// Getting the State from Mysql table for first list box////////// $Cyquer2="SELECT DISTINCT breweries.State, states.state FROM breweries INNER JOIN states ON breweries.State=states.a
  3. My PHP test file <?php $url="asset/go/"; ?> <!DOCTYPE html> <html> <head> <title>Page Title</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> </head> <body> <script> var user="mayor"; var url ='<?php echo json_encode($url); ?>'; if(user=="mayor"){ alert(url); } </script> </body> </html> Here is mu result <-- view-source:http://localhost/test/31248
  4. The file with the HTML AND PHP has to be a PHP file type not at HTML, i am assuming you are calling something.html instead of something.PHP
  5. Ok, save the guess result in a session, then if the session is not empty then display result the problem you'll have is you randomise the number every time the form page is loaded. Ideally one page is better for this project but you could do something like this: Without writing the code i'll try to explain what i mean. Checker on a guess check if the guess is correct, save the result message to a session -- if the number is correct then also set the random number to nothing Form if the random number is empty, then generate a new number, if a resu
  6. Malware, that's what I said WordPress ☺️ (I'm joking, kinda) Well done,
  7. Can you check the following? $fields['customer_firstname'] = "testing"; I know this isn't the end result i just want to check that you can receive the data passed
  8. Can you pass the object? What happens when? Just trying assign a string function onboarding_update_fields( $fields = array() ) { $user = wp_get_current_user(); //$fields['customertype'] = $user; $fields['customer_firstname'] = $user->user_firstname; return $fields; } does customer_firstname work? You might need to assign what you need instead of the entire object
  9. Let me start by saying phppup, your questions are very unclear, This makes it very difficult to help and will put people off offering help, You can save the images in a folder(s) or blobs in a database or save the image to a file and refer to it as via a script, Now, with "serving images" you will need to use the img tag when you display in html, you might use base64 instead of a path, e.g. URL vs BASE64 <!--URL image --> <img src='https://forums.phpfreaks.com/uploads/monthly_2020_10/logo-light.png.8ca2dc089c4e8fa3336b49fa0855692d.png' /> <!--Base64 imag
  10. Hi oymediasolution, I am assuming that WP or another system is installed some (another domain) the problem is these share the folders, it doesn't matter if its another domain, that only see the folders, if the add-on domain inside another domain? (folder wise) for example, /public_html <- main domain /public_html/new_domain <-addon_domain if this IS the case then it maybe worth looking at the main domain and checking if the same .htaccess file exists if so then you should be able to create a addon domain at the top level instead, this MAY solve the probl
  11. I'm about to go to sleep, but for a quick first look, You'll need to have the $user inside the function. e.g. function onboarding_update_fields( $fields = array() ) { $user = wp_get_current_user(); $fields['customertype'] = $user; return $fields; } Hope this helps
  12. I should also point out instead of building a class you could include the database.php and just use the $db_conn variable.. Depending on your end goal
  13. Maybe build an array for errors $errors = []; // This is the attempted validation code if(empty($firstname)) { $errors[] = "- Please enter your firstname"; } if(empty($email)) { $errors[] = "- Please enter your email"; } if (!empty($errors)) { $result="<p class='alert error'>There is an error. Please correct the following:"; $result =. implode("<br />", $errors); $result =. "</p>"; } else { //.... } echo $result; Untested code but should give you the idea EDIT: i always validate server side, but add client side validation to improve UX
  14. BUT if you use the incorrect method in the same execution as the correct method, then the success or lack of would be based on the order of execution and which may or may not be due the position of the code in the said file.
  15. See mac_gyver post and for the 500 error, its probablty the missing ; <?php session_start(); $conn = $_SESSION['dbhandler'] //<--missing ; mysqli_close($conn); echo "DB closed"; ?> Instead of passing parameters for the connection, just include the details <?php //db_config.php defined('DB_HOST') or define('DB_HOST', 'localhost'); defined('DB_USERNAME') or define('DB_USERNAME', 'username'); defined('DB_PASSWORD') or define('DB_PASSWORD', 'password'); <?php //database.php require(__DIR__.'/db_config.php'); // Create connection $db_conn = new mysqli(DB
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.