Jump to content

[SOLVED] hi i beginners question


jeppers

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

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.