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
https://forums.phpfreaks.com/topic/41336-submitting-forms/
Share on other sites

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.