tipu Posted April 2, 2007 Share Posted April 2, 2007 i bought a book on php mysql and i sort of digressed from the book, which is why i need help. the book told me how to create drop down menus within php, not html, and i was able to successfull do that. i used for loops instead of foreach, for my first comp. language is C++. anyways, i was able to create 3 drop down menus, 1 for the day, month, and year. how do i set up a button in the php that will redirect the information so that i can use it in other .php forms? I know how to do this using text/radio/check boxes using HTML forms, but not php. any help will be appreciated, thanks. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <?php $months = array (0=>'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'Novembver', 'December'); $days = range(1, 31); $years = range(2005,2015); echo '<select name = "month">'; for ($i = 0; $i < 12; $i++) { echo "<option>$months[$i]</option>"; } echo '</select>'; echo " "; echo '<select name = "days">'; for ($i = 0; $i < 31; $i++) { echo "<option>$days[$i]</option>"; } echo '</select>'; echo " "; echo '<select name = "year">'; for ($i = 0; $i < 11; $i++) { echo "<option>$years[$i]</option>"; } echo '</select>'; echo "<button>HELLOFATTO</button>"; ?> <body> </body> </html> Link to comment https://forums.phpfreaks.com/topic/45231-creating-a-button-within-php/ Share on other sites More sharing options...
jitesh Posted April 2, 2007 Share Posted April 2, 2007 Here as a Button we will use html component exa: echo "<input type=button name=button value=button>"; Link to comment https://forums.phpfreaks.com/topic/45231-creating-a-button-within-php/#findComment-219605 Share on other sites More sharing options...
tipu Posted April 2, 2007 Author Share Posted April 2, 2007 will i need to add echo '<form action = "handle_form.php" method="post">'; before it? Link to comment https://forums.phpfreaks.com/topic/45231-creating-a-button-within-php/#findComment-219608 Share on other sites More sharing options...
jitesh Posted April 2, 2007 Share Posted April 2, 2007 Can you explain what you excatly want to do ? Link to comment https://forums.phpfreaks.com/topic/45231-creating-a-button-within-php/#findComment-219620 Share on other sites More sharing options...
tipu Posted April 2, 2007 Author Share Posted April 2, 2007 so the code has 3 pull down menus. i'd like for the operator to choose a day, month, and a year. when hitting submit. i'll be able to request the day, month, and the year on the following php page (the page that comes after 'submit' is pressed) Link to comment https://forums.phpfreaks.com/topic/45231-creating-a-button-within-php/#findComment-219625 Share on other sites More sharing options...
jitesh Posted April 2, 2007 Share Posted April 2, 2007 <form name=""frm" action="next_page_to_redirect.php" method="post"> <select name=day> .... </select> <select name=month> .... </select> <select name=year> .... </select> <input type="Submit" name="Submit" value="press button"> ( echo "<input type=\"Submit\" name=\"Submit\" value=\"press button\">"; ) </form> Link to comment https://forums.phpfreaks.com/topic/45231-creating-a-button-within-php/#findComment-219659 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.