2 POST forms, not posting correctly

software development

#1

I’ve been looking over these post forms looking for reasons why it’s not posting the hidden $event_id. This value is being populated in the form when looking at the page source, but isn’t getting passed to the event_signup.html page. Can anyone take a look and let me know if they see anything wrong? The html looks to be nested correctly…I thought maybe because there are 2 forms on the page and it’s calling the validation function with “this”?

FYI, we use a heredoc on this page, hence no quotes and the like.

Please enter your member ID
to make your reservation.
Membership id:
Send my member ID to
my registered e-mail address.
E-mail Adress:

Not a member? Register and signup here.

================================
Angela Gann
CrimsonDryad Web Design Services
Web Design, Custom Software Development
http://www.crimsondryad.com


#2

Your form isn’t making any sense to me at all. You appear to be using JavaScript to do form validation and submission (a double-plus ungood, by the way) but you haven’t shown your JavaScript. Are you processing the form as PHP?


si-blog | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#3

Hi scjessey. :slight_smile:

I actually didn’t write this script, my (now-fired) other programmer did, so I can’t tell you all the logic because I think he writes jacked up code. :stuck_out_tongue: Unfortunately, we’re too far through this project to just rip out his craziness. But yes, this is a PHP-generated page. That section is using a heredoc, which is how we have $event_id showing up without something like <?= $event_id ?>.

He used separate Javascript functions to do validation and submission (and yes, I would agree, a double ungood). He’s absolutely obsessed with ajaxy stuff. Ajax is good, but it’s not the end all to everything.

Here are the functions, and yes they are calling more Javascript code. Including it all would be involved and confusing. If you tell me he’s nuts and I should just rewrite that piece, I’ll take your advice seriously…though I’d rather just fix it and move on.

================================
Angela Gann
CrimsonDryad Web Design Services
Web Design, Custom Software Development
http://www.crimsondryad.com


#4

My JavaScript isn’t very good, but it looks as if you are submitting either form to itself for validation. I can’t see your PHP, but my guess is that $event_id is being passed but you aren’t collecting it properly. Remember that since you are using POST as the method of the forms, the variable is only going to be accessible as $_POST[‘event_id’] because of the fact the register_globals is disabled.


si-blog | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#5

I don’t see a closing form tag for the second form. Am I just missing it?


#6

It’s getting to the source of the page. The $event_id is ok because that var is actually being set with a PHP function call.

I think that’s the reason he used the Javascript for validation and submission, because he was keeping the person on the same page while validating their member id. If he did an HTML submit, the PHP function would run again.

My javascript is poor too. Just haven’t had time to learn it, though I may have to now.

================================
Angela Gann
CrimsonDryad Web Design Services
Web Design, Custom Software Development
http://www.crimsondryad.com


#7

Don’t you need to give it a name or id?

I don’t see how you’d be collecting $event_id, even if its value is printing out in the source.


:stuck_out_tongue: Save up to $96 at Dreamhost with ALMOST97 promo code (I get $1).
Or save $97 with THEFULL97.


#8

He’s right. It will need a name, or it simply won’t be passed in the POST data.


si-blog | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#9

Good catch… though I fixed that and it’s still not passing. sigh

================================
Angela Gann
CrimsonDryad Web Design Services
Web Design, Custom Software Development
http://www.crimsondryad.com


#10

Thanks guys, I really appreciate that several of you are helping on this. I had an idea that it’s probably something fairly easy to fix, but debugging is hell.

The post form is passing the customer_membership_id, which looking at what’s there, I’m not sure how since I don’t see where it’s populating that. But it’s not passing the event_id.

I hate Javascript. I think that’s where the problem is right now. An alert box pops up that the user has to click “OK” on that says “Validating member id” I think he’s got it set up that way right now because he was debugging.

================================
Angela Gann
CrimsonDryad Web Design Services
Web Design, Custom Software Development
http://www.crimsondryad.com


#11

When you created a name for that value, did you then work that name into the receiving page that processes it?

Otherwise, if the name was left out of page 1, there probably wasn’t anything in page 2 to handle it.


:stuck_out_tongue: Save up to $96 at Dreamhost with ALMOST97 promo code (I get $1).
Or save $97 with THEFULL97.


#12

Nah, I’m doing print_r($_POST) right now because I’m debugging. I also cleared the cache and resubmitted the form from scratch, no joy.

================================
Angela Gann
CrimsonDryad Web Design Services
Web Design, Custom Software Development
http://www.crimsondryad.com


#13

Ok, I get points for the developmentally slow approach. I had opened the file for reading and not writing and I assumed when I clicked the “save” button that it was saving, when in fact it was not.

So once I saved it with the event_id name, it worked.

Thanks again guys!

================================
Angela Gann
CrimsonDryad Web Design Services
Web Design, Custom Software Development
http://www.crimsondryad.com


#14

Good… because I was out of ideas. :stuck_out_tongue:


:stuck_out_tongue: Save up to $96 at Dreamhost with ALMOST97 promo code (I get $1).
Or save $97 with THEFULL97.


#15

Eh, but I didn’t know that. So I can still worship your greatness in divine ignorance. hehehe

================================
Angela Gann
CrimsonDryad Web Design Services
Web Design, Custom Software Development
http://www.crimsondryad.com