Jump to content

submitting forms


dekonstruct

Recommended Posts

Hello, I've got a form that is built using php. It counts backwards from todays date to zero and each number is a selection. I then pass this number variable to another page called num.php

 

I was wondering if there's a way to get rid of that submit button and still be able to pass my php variables to num.php. I've tried some things in javascript but it didn't pass the php variables along with it.

 

Here's the code for the form:

<form method="post" action="num.php">
<select name="num">
<?php
$y = date('z') + 1;
for($x = 1; $x < $y; $x++) {
	print "<option>$x</option>\n";
}
?>
<input type="submit" value="submit" name="submit">
</select>
</form>

 

Here's the code on num.php in case you need it:

<?php
session_start();
$_SESSION['dailies'] = $_POST["num"] - 1;
?>

 

Many thanks in advance.

Link to comment
Share on other sites

You have to submit the form somehow. I think you can use an onSelect javascript function to automatically submit the form when a user selects an option.

 

Try the javascript forum, they will be able to help you much more than we will.

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.