/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Is this Possible?

[code=html]<select class=”form-control” name=”groupid” onchange=”this.form.submit();”>[/code]

Is it possible to include a call to:

[code=php]if($_POST[‘dump’]) {

}[/code]

in the [B]onchange[/B] up there? If so, how wld it be done? Thanks.

to post a comment
PHP

7 Comments(s)

Copy linkTweet thisAlerts:
@NogDogNov 23.2015 — Do you mean something like this?
[code=php]
<select class="form-control" name="groupid" onchange="this.form.submit('<?php
echo $_POST['dump']
?>');">
[/code]
Copy linkTweet thisAlerts:
@LandslydeauthorNov 23.2015 — Hey NogDog:

I gave that a whirl with no success. Sure appreciate you though. I'll probably end up taking out the [B]onchange[/B] and adding a Load button, then disable it after the Load executes and enable an added Dump button. For ease of use, I'm wanting to automate as much as I can, combining events where possible and controlling their execution through control variables. Thing is, I've already tried it with the buttons. But since all of them are of type Submit, no matter how I change their attribute they all change back to their original state when any button is clicked. I'm old school when it comes to coding (Pascal & C++), started in '83. But not being able to control the enabling / disabling of buttons is putting more nails in my coffin than necessary ? Thanks again for your help.
Copy linkTweet thisAlerts:
@ginerjmNov 24.2015 — Instead of just presenting us with a small situation, how about describing your ultimate goal as your question? You began with a scenario concerning triggering a submit from a dropdown with some kind of connection to a post variable. So you got that back as a possible solution from NogDog.

Your last post discusses a completely different problem it appears. Something (again) about enabling or disabling buttons and (confusingly) whether they are 'submit' buttons.

What is your Real Problem? What are you trying to write here? Plus - it appears that you may actually be trying to join JS activity with server-based PHP code. Not sure but my thinking is that you may be.

If all you want to do is produce disabled buttons from your php script based upon some data situation, then that is a simple task. If you are trying to do it as the user is clicking away on the web page, that is a bit more of a problem, but unless you are using an ajax call from one of those clicks, you can't intermingle PHP with that process.

So - how about an English-based description of your question?
Copy linkTweet thisAlerts:
@LandslydeauthorNov 24.2015 — ...how about an English-based description of your question?[/QUOTE]

I'm not sure what you're referring to, ginerjm. I've checked, and, having withheld southern slang, all my words in my posts are definitely in both my Webster's Encyclopedic Unabridged Dictionary of the English Language and my American Heritage Dictionary of the English Language. Perhaps what you were trying to say is that it might be helpful were I to paint with a broader brush and not one so thin. If so, then I will try to keep that in mind with future posts. But as for this one, I resolved it last night with control variables.
Copy linkTweet thisAlerts:
@LandslydeauthorNov 25.2015 — I [B]do[/B] hate eating crow, but my control variables were flop. Actually, I believe NogDog had it right with:

[CODE]<select class="form-control" id="groupid" name="groupid" onchange="this.form.submit('<?php echo $_POST["dump"] ?>');">[/CODE]

So I'm wondering if the syntax is correct on this, with regards to the:

[code=html] onchange="this.form.submit('<?php echo $_POST["dump"] ?>')[/code]

The[COLOR="#0000CD"] $_POST['dump'][/COLOR] event is what I need to be called with the[COLOR="#0000CD"] this.form.submit[/COLOR], but it isn't being called. It's absolutely essential for this to be called when the Select Box changes, else it makes two tables in the db worthless. I currently have a Dump button of type Submit to handle this. But just as sure as the sun rises in the east, a user will forget to click it before making a new selection. NogDog's suggestion is the right way to go...the [B]only[/B] way to go, but it's not being called with the way he's shown me.

The[COLOR="#0000CD"] $_POST['dump'][/COLOR] event inside the [COLOR="#0000CD"]this.form.submit()[/COLOR] isn't working. Is there another way to work that line of code so that it gets called?
Copy linkTweet thisAlerts:
@NogDogNov 25.2015 — When the form is displayed now, what is there when you do a "view source" in the browser (or inspect it with Firebug, or whatever you prefer to see what the source HTML actually looks like). Based on what you see there, you can determine whether it's something that needs to change in the PHP, or if you have a JavaScript problem.
Copy linkTweet thisAlerts:
@LandslydeauthorNov 25.2015 — Hey NogDog:

Thanks for replying. I'm not using JavaScript, at least not a JavaScript function call. Just using the onchange event to submit when the user makes a selection in the Group Selection Box. Please view my new post as it has the contents of $_POST['dump']. If I need to post more code, please advise.
×

Success!

Help @Landslyde spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...