Jump to content

Recommended Posts

ok so now I have an issue where I am working with php5 and things aren't working.

 

basically I am using an html form with a hidden value to tell the program what set of code to use but the hidden values aren't being read once I hit the submit button.

 

here is a bit of code

 

<div id='header'><br></div><div id="main">
Please Select the Chapter you would like to access from the list. 
<form action="home.php" method="POST">
<?php
include ("allchapter.inc");
?>
<input type="hidden" name="action" value="actualswitch">
<input type="submit" value="Chapter Switch" name="esubmit">
</form>
</div>

 

so after this form is submitted I would get a blank page. I added the following line to home.php to see if the results would change.

 

$action = !empty($_GET['action']) ? $_GET['action'] : 'main';

 

so now when i submit the form it goes to the main option and not the one I have as a hidden value. any idea why the value wouldn't be passed or why it is not being read?

 

I know this is a simple thing just can't figure it out at the moment.

 

any help is appreciated

Thanks

Bill

Link to comment
https://forums.phpfreaks.com/topic/187031-another-question-about-passing-a-value/
Share on other sites

If you want to send the action value as a $_GET variable, you will need to put it on the end of the URL in the form's action="home.php" attribute -

 

action="home.php?action=actualswitch"

I don't know why I didn't see that the method was POST.  PFM has the right answer here

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.