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
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>';

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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