Jump to content

Form and hidden textfields


Niixie

Recommended Posts

Hey all, i have a little problem.

 

I have a form, and when submitting, i need to use the ID that i put in the $_GET array earlier.

 

When you're entering my site, and clicks a certain link, the $_GET will store show=1, and when you're submitting the form on the page, the value of 'show' is needed on the redirect page.. I thought that it would be smart to transfer it with a hidden textfield, but somehow it fails?

 

<form id="comment-form" action="comment_profile.php" method="POST">
                                    <fieldset>
                                        <div class="field">
                                            <textarea name="comment-field" rows="2" cols="66"></textarea>
                                            <input type="hidden" name="pofileid-field" value="<?php echo $_GET['show']; ?>" /> // <--- Here is the hidden field.
                                            <input type="submit" name="submit-field" class="submit" value=""/><i> (HTML tags kan bruges)</i>
                                        </div>
                                    </fieldset>
                                </form>

 

Above you can see a piece of my code, and i marked the hidden field aswell.

What i do not understand is, why isn't the hidden fields value return the value of show when i check in comment_profile.php, as that is where it returns?

 

Thanks in advance

-Niixie

Link to comment
https://forums.phpfreaks.com/topic/254619-form-and-hidden-textfields/
Share on other sites

Not sure how your code is formatted because i see ""// <--- Here is the hidden field."" and that is a php comment lol ;)

but your code looks like it is written in html

 

<?php

echo '<form id="comment-form" action="comment_profile.php" method="POST">
<fieldset>
<div class="field">
<textarea name="comment-field" rows="2" cols="66"></textarea>
<input type="hidden" name="pofileid-field" value="'.((array_key_exists('show',$_GET))?$_GET['show']:null).'" />
<input type="submit" name="submit-field" class="submit" value=""/><i> (HTML tags kan bruges)</i>
</div>
</fieldset>
</form>';

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.