Jump to content

Search the Community

Showing results for tags 'form php'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. Hi all, I'm looking for some pointers in regards to my form.. How would I firstly trim the $_POST value of the variables that come through via the form (I'm only using one for now)..I know I'm making a right dogs dinner of it. In my head I'm thinking, trim all the posts first before i even assign a variable to it ( i dont know if thats possible), then use an array for when more values start coming through via the form. You know as i make a contact form that requires more data from the user.. <?php require_once '../connection/dbconfig.php'; include_once('../connection/connectionz.php'); //get the values //Get the request method from the $_SERVER $requestType = $_SERVER['REQUEST_METHOD']; //this is what type //echo $requestType ; if($requestType == 'POST') { //now trim all $_POSTS $search_products = trim($_POST['search_products']); // if(empty($search_products)){ echo '<h4>You must type a word to search!</h4>'; }else{ $make = '<h4>No match found!</h4>'; $new_search_products = "%" . $search_products . "%"; $sql = "SELECT * FROM product WHERE name LIKE ?"; //prepared statement $stmt = mysqli_stmt_init($conDB); //prepare prepared statements if(!mysqli_stmt_prepare($stmt,$sql)) { echo "SQL Statement failed"; }else{ //bind parameters to the placeholder mysqli_stmt_bind_param($stmt, "s", $new_search_products ); mysqli_stmt_execute($stmt); $result = mysqli_stmt_get_result($stmt); echo'<h2> Search Result</h2>'; echo 'You searched for <strong><em>'. $search_products.'</em></strong>'; while($row = mysqli_fetch_assoc($result)){ echo '<h4> (ID : '.$row['pid']; echo ') Book Title : '.$row['name']; echo '</h4>'; } } } } ;?> If any one can shed some light on this, or some pointers..that would be very nice... Thanks Darren
  2. Given an input of an expression consisting of a string of letters and operators (plus sign, minus sign, and letters. IE: ‘b-d+e-f’) and a file with a set of variable/value pairs separated by commas (i.e: a=1,b=7,c=3,d=14) write a program that would output the result of the inputted expression. For example, if the expression input was ("a + b+c -d") and the file input was ( a=1,b=7,c=3,d=14) the output would be -3. Thus fur I have got this, it calculates the numbers but not sure how to calculate it by the letters abcd, <html> <head> </head> <body> <form action = "" method = "GET"> Number 1: <input type = "text" name = "input[]" size=3> <br/> Number 2: <input type = "text" name = "input[]" size=3> <br> Number 3: <input type = "text" name = "input[]" size=3> <br> Number 4: <input type = "text" name = "input[]" size=3> <br> <input type="hidden" name="calc" value ="yes"> <input type = "submit" name = "Calculate"/> </form> </body> </html> <?php print_r($_GET); $myInputs = $_GET['input']; print_r($myInputs); $myArray = array(); $myArray['a'] = 5; $myArray['b'] = 10 ; $myArray['c'] = 15 ; $myArray['d'] = 20 ; echo $myArray[$_GET['a']] + $myArray[$_GET['b']] ; /* if ($_GET['calc'] == "yes") { $a = $_GET['a']; $b = $_GET['b']; $c = $_GET['c']; $d = $_GET['d']; $total = $a+$b+$c+$d; print "Total is: $total <p>"; } */ ?>
×
×
  • 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.