Jump to content

Search the Community

Showing results for tags 'action'.

  • 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 4 results

  1. Typically when you submit a form, it's in a format like this "collections?type='wheels'&make='acura'&year='2016'&model='mdx' ". Instead of that format, I would like to do something like this " collections/wheels/acura+2016+mdx ". How would I go on about doing that format with jquery submit form? This is my setup so far. <script> // Code goes here $(document).ready(function() { $('#search').on('submit', function() { var type = $('#type').val(); var make = $('#make').val(); var year = $('#year').val(); var model = $('#model').val(); var formAction = $('#search-form').attr('action'); $('#search-form').attr('action', formAction + type + make + year + model); }); </script> <form id="search-form" action="/collections/" method="get"> <select id="type" name="type"> // type list goes here </select> <select id="make" name="make"> // make list goes here </select> <select id="year" name="year"> // year list goes here </select> <select id="model" name="model"> // model list goes here </select> <input type="submit" id="search" value="Search"> </form>
  2. I am reading images from the directory 'images' which contains several folders with images. I want to show every image in a div and with the checkbox to decide if it is fashion or not fashion. I am using the following code in order to read files from directory and showing them in browser. The divs is one after other: <?php function listFolderFiles($dir){ $html = ''; // Init the session if it did not start yet if(session_id() == '') session_start(); $html .= '<ol>'; foreach(new DirectoryIterator($dir) as $folder){ if(!$folder->isDot()){ if($folder->isDir()){ // $html .= '<li>'; $user = $dir . '/' . $folder; foreach (new DirectoryIterator($user) as $file) { if($file != '.' && $file != '..'){ $image = $user . '/' . $file; // Check the pictures URLs in the session if(isset($_SESSION['pictures']) && is_array($_SESSION['pictures'])){ // Check if this image was already served if(in_array($image, $_SESSION['pictures'])){ // Skip this image continue; } } else { // Create the session variable $_SESSION['pictures'] = array(); } // Add this image URL to the session $_SESSION['pictures'][] = $image; // Build the form //echo $image, "</br>"; $html .= ' <style> form{ font-size: 150%; font-family: "Courier New", Monospace; display: inline-block; align: middle; text-align: center; font-weight: bold; } </style> <form class = "form" action="' . action($image) . '" method="post"> <div> <img src="' . $image . '" alt="" /> </div> <label for="C1">FASHION</label> <input id="fashion" type="radio" name="fashion" id="C1" value="fashion" /> <label for="C2"> NON FASHION </label> <input id="nfashion" type="radio" name="nfashion" id="C2" value="nfashion" /> <input type="submit" value="submit" /> </form>'; // Show one image at a time // Break the loop break 2; } } // $html .= '</li>'; } } } $html .= '</ol>'; return $html; } //##### Action function function action($img){ $myfile = fopen("annotation.txt", "a"); if (isset($_POST['fashion'])) { fwrite($myfile, $img." -- fashion\n"); // echo '<br />' . 'fashion image'; } else{ fwrite($myfile, $img." -- nonFashion\n"); // echo '<br />' . ' The submit button was pressed<br />'; } } echo listFolderFiles('images//'); ?> When I make call of action($image) from inside form tag, I noticed, that a default value of submit it is parsed to the function, thus it stores the name of the image with the default value and the chosen value for the first image it is parsed to the second image, the chosen value of the second image it is stored to the file with the third image and so on. When I make call in side input submit tag it began storing to the file from the second image with the value of the first one and so on. I couldn't manage to have stored to the file the correct correspondence between the image and the chosen value. Where should I make call of the action function in order to do it properly?
  3. $formhtml="<form action="sometext" method="POST">"; Please this is driving me nuts how can i remove an action="sometext" or action="" from a form?
  4. I'll throw you all a softball, since I'm sure this has to be easy and I'm just daft... All I'm trying to do is create an html form that posts data to a php file on my server. But the php file isn't a webpage. It's just a file in one of my subfolders. When I put what I believe the absolute url to the file on my server in as the action, it brings me to a blank white page and nothing happens. I believe I get the concept of using $_POST to get the information and handle it....but how do I get it to the file?
×
×
  • 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.