Welcome Guest, Not a member yet? Register   Sign In
Can I run a foreach on submitted form data?
#11

[eluser]louis w[/eluser]
Could you try it with no spaces in the field name?

UPDATE: It's def the hidden elements on your page. If i remove them with Firebug it works fine. What are they for?
#12

[eluser]Robert May[/eluser]
That was my attempt to pass the name of the field. Am I completely mistaken in thinking that I can't actually dynamically retrieve the name of the array variable being sent?

This is the print_r now:

Array ( [wearing_hatval] => Yes [site_nameval] => Avast! [news_per_pageval] => 5 )

I need to pick up both the wearing_hatval and the yes. I just can't think of how to do it, it's literally driven me nuts - my brain is so confused!
It needs to know where to stick the data, and put the correct data there.
#13

[eluser]louis w[/eluser]
Code:
foreach ($fields as $name => $value) {
    echo '<p>'.$name.' = '.$value.'</p>';
}
#14

[eluser]Robert May[/eluser]
I could kiss you right now.
You have quite literally saved my day.

Thank you very, very much.
#15

[eluser]louis w[/eluser]
Glad I could help Smile




Theme © iAndrew 2016 - Forum software by © MyBB