Skip to content

u/preventDefault

In this archive from Apr 2012 to Jan 2023

6
posts
32
comments
3
media
67
score

Top posts

Top comments

Sorry I can't be of more help, but JQuery would make the Ajax side of things much easier.

http://api.jquery.com/jQuery.ajax/

I think you can keep a single PHP file to handle to each form, and just have it check for a hidden form element so it knows which form its handling.

HTML:

<input type="hidden" name="form" value="a">

PHP:

switch ($_GET['form']) {
     case "a":
          // do something
          break;
     case "b":
          // do something else
          break;
     default:
          // default behavior goes here
          break;
}

I'd also sanitize $q. Never a good idea to take user input and put it directly into a SQL query.

I'm new to this stuff myself but that's where I'd start. :)

10 points

Subreddits

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.