Jump to content

Recommended Posts

All i want to do is retrieve the data from this pull down menu. and print it on a different form. hear is my pull down menu what do u reckon

 

<body>
<form action="calender.php" method="post">

<?php

//make the months array 
$months = array (1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');

//make the days and years array 
$days = range (1, 31);
$years = range (2007, 2020);

//make that months pull down menus
echo '<select name="months">';
foreach ($months as $key => $value) {
echo "<option value=\"$key\">$value</option>\n";
}
echo '</select>';

//make the days pull down menu 
echo '<select name="days">';
foreach ($days as $key => $value) {
echo "<option value=\"$key\">$value</option>\n";
}
echo '</select>';

//make the year pull down menu 
echo '<select name="years">';
foreach ($years as $key => $value) {
echo "<option value=\"$key\">$value</option>\n";
}
echo '</select>';

?> 
<input type="submit" name="submit" value="submit" />

Link to comment
https://forums.phpfreaks.com/topic/74788-solved-hi-i-beginners-question/
Share on other sites

thanks for the last post help lost but my next problem is that its taking the array values like the number which in the array.. for example

 

3 august 2007 would pint out as 3 8 0. i want to no how to keep the number string values and number size.

 

how i retrieved the variables

 

$days = ($_POST['days']);
$months = ($_POST['months']);
$years = ($_POST['years'] as string);

//create a date variable 
$date = $days .''. $months .''. $years;

echo "$date";

 

can u help

thanks

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.