PHP - Moved: Retrieving Form Option Value And Option Text
This topic has been moved to JavaScript Help.
http://www.phpfreaks.com/forums/index.php?topic=307346.0 Similar TutorialsThis topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=333152.0 Hi all, i need some help in retaining the values in an <option> textbox.. I have found a code to loop the date online, and use it for Javascript jump menu, but i have no ideas how to retain the option.. here are my codes(in red), $year1 = date('Y'); $month1 = date('m'); $day1 = date('j'); $day1 = $day1 + 1; $year2 = date('Y') + 2; $month2 = date('m'); $day2 = date('j'); $start_date = "$year1-$month1-$day1"; $end_date = "$year2-$month2-$day2"; $date = mktime(0,0,0,$month1,$day1,$year1); //Gets Unix timestamp START DATE $date1 = mktime(0,0,0,$month2,$day2,$year2); //Gets Unix timestamp END DATE $difference = $date1-$date; //Calcuates Difference $daysago = floor($difference /60/60/24); //Calculates Days Old $i = 0; while ($i <= $daysago +1) { if ($i != 0) { $date = $date + 86400; } else { $date = $date - 86400; } $yy1 = date('Y',$date); $mm1 = date('m',$date); $dd1 = date('d',$date); $date3 = "$yy1-$mm1-$dd1" ; echo "<option value=\"test1234.php?m=$mm1&y=$yy1&d=$dd1\" "; echo ">".$date3 ."</option>"; $i++; } i know that i have to something selected, but i dun understand how this set of date code loop which left me helpless. This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=315351.0 Hello again everyone, I am new to PHP. This is the second part of a question: Question: In the program you created in question 4, allow your user the option of saving the information for the next time they visit. If they choose "yes", save information in a cookie. At the bottom of question5.php I added a checkbox to save the information. I then created an if statement on the processing page (question5display.php. I would appreciate some help, thanks guys. Here is the form ( called it question5.php): <html> <head> <title> Please Enter Your Text</title> </head> <body> <form method="post" action="question5display.php"> <p>Enter the text you want formatted please: <input type="text" name="textformat" maxlength="30" size="30" /> <table> <tr> <td><label for="font">Select Font:</label></td> <td><select id="font" name="font"> <option value="Verdana">Verdana</option> <option value="Arial">Arial</option> <option value="Times New Roman">Times New Roman</option> </select> </td> </tr> <tr> <td><label for ="size">Select Size:</label></td> <td><select id="size" name="size"> <option value="10px">10px</option> <option value="12px">12px</option> <option value="14px">14px</option> <option value="20px">20px</option> </select> </td> </tr> <tr> <td><label for="color">Select Color:</label></td> <td><select id="color" name="color"> <option value="green">Green</option> <option value="blue">Blue</option> <option value="red">Red</option> </select> </td> </tr> </table> <input type="checkbox" id="save_prefs" name="save_prefs" /> <label for="save_prefs">Save these preferences for the next time you log in.</label> <input type="submit" name="submit" value="Submit" /> </form> </body> </html> Here is the page it goes to (called it question5display): <?php if (isset($_POST['save_prefs'])) { setcookie('font', $_POST['font'], time() + 60); setcookie('size', $_POST['size'], time() + 60); setcookie('color', $_POST['color'], time() + 60); $_COOKIE['font'] = $_SESSION['font']; $_COOKIE['size'] = $_SESSION['size']; $_COOKIE['color'] = $_SESSION['color']; } session_start(); $_SESSION['textformat'] = $_POST['textformat']; $_SESSION['font'] = $_POST['font']; $_SESSION['size'] = $_POST['size']; $_SESSION['color'] = $_POST['color']; ?> <html> <head> </head> <body> <p <?php echo ' style="font-family: ' . $_SESSION['font'] . '; '; echo 'font-size: ' . $_SESSION['size'] . '; '; echo 'color: ' . $_SESSION['color'] . ';" '; ?>> <?php echo $_SESSION['textformat']; ?> </p> </body> </html> I have an array for recipients 'recipients' => array( 'user@example.com', ),() and I need to mail different recipients by form option, something like this switch($_POST['color']){ case 'red': $recipient = 'redperson@example.com'; break; case 'green': $recipient = 'greenperson@example.com'; break; case 'blue': $recipient = 'blueperson@example.com'; break; default: $recipient = 'user@example.com'; }() I don't know how to combine the two? Hi, I have an html form in "send.htm" that sends data to "retrieve.php" with the following structu send.htm: Code: [Select] <html> <body> <form method="post" action="retrieve.php" <select id='select' name='select' > <option>option1</option> <option>option2</option> <option>option3</option> <option>etc...</option> </select> <input type="submit"> </form> </body> </html> retrieve.php: Code: [Select] <?php $selectedoption = $_POST['select']; print" <html> <body> <select id='select' name='select' > <option>option1</option> <option>option2</option> <option>option3</option> <option>etc...</option> </select> </body> </html> "; ?> How do I specify that the select menu in retrieve.php should have the option selected that was chosen from the select menu in send.htm? I'm guessing this is probably quite straightforward, but I can't quite work it out. Please help! Thanks. Hi I have a list of states using the array method in a form. The drop down menu works fine. I want to save the user choice,if the form is re-displayed due to a blank field or pattern mismatch. I know I can use the selected=selected, but don't know wher to put the statement: My array is: state_province = array ("list of states", "provinces") Var in my labels array is "state"=>"state" Here is my code for the select/option statement: { if($field == "state") { echo "<div class='province_state'><label for='state' size='10'>* Province/State</label><select>"; foreach($state_province as $state) { echo "\n<option value='$state_province' /> "; echo $state ; echo "</option>"; } echo "</select></div>\n"; } ?Is this the correct code to add and where would I add it? if(@$_POST['state'] == $value) { echo "selected='selected' "; } how would i render this Code: [Select] <select name="state" value="<?php echo $state; ?>"> <option>Select a state</option> <option value="AL">Alabama</option> <option value="AK">Alaska</option> <option value="AZ">Arizona</option> <option value="AR">Arkansas</option> <option value="CA">California</option> <option value="CO">Colorado</option> <option value="CT">Connecticut</option> <option value="DE">Delaware</option> <option value="DC">District Of Columbia</option> <option value="FL">Florida</option> <option value="GA">Georgia</option> <option value="HI">Hawaii</option> <option value="ID">Idaho</option> <option value="IL">Illinois</option> <option value="IN">Indiana</option> <option value="IA">Iowa</option> <option value="KS">Kansas</option> <option value="KY">Kentucky</option> <option value="LA">Louisiana</option> <option value="ME">Maine</option> <option value="MD">Maryland</option> <option value="MA">Massachusetts</option> <option value="MI">Michigan</option> <option value="MN">Minnesota</option> <option value="MS">Mississippi</option> <option value="MO">Missouri</option> <option value="MT">Montana</option> <option value="NE">Nebraska</option> <option value="NV">Nevada</option> <option value="NH">New Hampshire</option> <option value="NJ">New Jersey</option> <option value="NM">New Mexico</option> <option value="NY">New York</option> <option value="NC">North Carolina</option> <option value="ND">North Dakota</option> <option value="OH">Ohio</option> <option value="OK">Oklahoma</option> <option value="OR">Oregon</option> <option value="PA">Pennsylvania</option> <option value="RI">Rhode Island</option> <option value="SC">South Carolina</option> <option value="SD">South Dakota</option> <option value="TN">Tennessee</option> <option value="TX">Texas</option> <option value="UT">Utah</option> <option value="VT">Vermont</option> <option value="VA">Virginia</option> <option value="WA">Washington</option> <option value="WV">West Virginia</option> <option value="WI">Wisconsin</option> <option value="WY">Wyoming</option> </select> I am using PHP for CV Generator. I need to add an element for 'Add another' option, e.g. on employment section, if you have more than one job you may require to add another form. Would this work with PHP coding? If so, what is it called? If not so, maybe Javascript? I can google for it when I get a answer from you guys. By the way, you may be aware with this- I have a little experience with PHP coding. Dean Do I need to add value to this select statement? Code: [Select] <select id="expYear" name="expYear"> <option></option> <option>2011</option> <option>2012</option> <option>2013</option> <option>2014</option> <option>2015</option> <option>2016</option> <option>2017</option> <option>2018</option> <option>2019</option> <option>2020</option> </select> Debbie I'm having the strangest thing happing. When posting a form i'm not getting the option value. Instead its posting my text field ie: <option name="1">text</option> Code: [Select] <?php $query = "SELECT id, name FROM locations ORDER BY name"; $res = mysql_query($query, $cid); while($a = mysql_fetch_array($res)) { echo "<option name=".$a["id"].">".$a["name"]."</option>"; } ?> Code: [Select] <?php The code thats grapping it: if($_POST['location']==""){ $location = ""; echo '<div class="message error">Please enter a <strong>Location</strong></div>'; }else{ $location = $_POST['location']; } ?> Can anyone see why? I have also tried it in html to see if its my php, but i get the same result I'm trying to create VIP zone, but I need to check if user has input correct username and password....I tried to make it work this way HTML Code: [Select] <form action="vipchat.php" method="post" /> Korisnicko ime: <input type="text" name="ime"/> Lozinka: <input type="password" name="lozinka"/> <input type="submit" value="Uloguj se"/> </form>php Code: [Select] <?php $imet = "komp"; $sifrat = "racun"; if ($_POST["ime"]==$imet)and($_POST["lozinka"]==$sifrat) echo "Tacno je"; else echo "Netacno je"; ?> But it gives me this error Code: [Select] Parse error: syntax error, unexpected T_LOGICAL_AND in C:\AppServ\www\adm\vipchat.php on line 16 ok this works fine and everything but when here when i try to let the admin changes stuff and goes to change the venue a list show appear and it does but when it save it save it as RBB FIELD <option value="RED BULL ARENA">RED BULL ARENA</option><option value="RBB FIELD ">RBB FIELD </option><option value="RED BULL ARENA">RED BULL ARENA</option> why does it do that?? HElp ANYONE Code Code: [Select] <?php if (isset($_GET['eid'])){ $newid = $_GET['eid']; $sqlCommand = "SELECT * FROM events WHERE id='$newid' LIMIT 1"; $out = mysql_query($sqlCommand); $row = mysql_fetch_assoc($out); $eventid = $row["id"]; $eventname = $row["eventname"]; $eventtype = $row["typeevent"]; $eventinfo = $row["eventinfo"]; $date = $row["date"]; $time = $row["time"]; $livetickets = $row["sale"]; $numtickets = $row["numtickets"]; $pricestudents = $row["studentsprice"]; $priceseniors = $row["seniorsprice"]; $priceadults = $row["adultsprice"]; $venues = $row["venue"]; $category = $row["category"]; $query = mysql_query("SELECT venuename FROM venue"); while ($row = mysql_fetch_array($query)){ $venues .= '<option value="' . $row['venuename'] . '">' . $row['venuename'] . '</option>'; } $form = "<form action='eevent.php' method='post' enctype='multipart/form-data'> <table> <tr> <td>REQUIRED FIELDS *</td> <td></td> </tr> <tr> <td>Event Name*</td> <td><textarea cols='17' rows='1' name='eventname' />$eventname</textarea></td> </tr> <tr> <td>Type of event*</td> <td><textarea cols='17' rows='1' name='typeevent' />$eventtype</textarea></td> </tr> <tr> <td>Event Inforamtion*</td> <td><textarea name='eventinfo' cols='40' rows='5'>$eventinfo</textarea></td> </tr> <tr> <td>Date</td> <td><input type='text' size='10' name='date' value='$date' /></td> </tr> <tr> <td>Time</td> <td><input type='text' size='10' name='time' value='$time' /></td> </tr> <tr> <td>When tickets go on sale</td> <td><input type='text' size='10' name='sale' value='$livetickets' /></td> </tr> <tr> <td>Number of Tickets Available </td> <td><input type='text' size='5' name='numtickets' value='$numtickets' /></td> </tr> <tr> <td><h4>Ticket Prices</h4></td> </tr> <tr> <td>STUDENTS</td> <td>$<input type='text' size='3' name='studentsprice' value='$pricestudents'/></td> </tr> <tr> <td>SENIORS</td> <td>$<input type='text' size='3' name='seniorsprice' value='$priceseniors'/></td> </tr> <tr> <td>ADULTS</td> <td>$<input type='text' size='3' name='adultsprice' value='$priceadults' /></td> </tr> <tr> <td>SELECT VENUE</td> <td> <select name='venue'> <option value='$venues'>$venues</option> </select> </td> </tr> <tr> <td>SELECT CATEGORY</td> <td> <select name='category'> <option value='$category'>$category</option> <option>FOOTBALL</option> <option>BASKETBALL</option> <option>HOCKEY</option> <option>DRAMA</option> <option>MUSIC</option> <option>DANCE</option> <option>VISUAL ARTS</option> </select> </td> </tr> <tr> <td></td> <td><input type='hidden' name='saveevent' value='$newid'/></td> <td><input type='submit' name='savechanges' value='Save Changes'/></td> </tr> </table> </form>"; echo "$form"; } if ($_POST['saveevent']){ $newid = mysql_real_escape_string($_POST['saveevent']); $eventname = mysql_real_escape_string($_POST['eventname']); $eventtype = mysql_real_escape_string($_POST['typeevent']); $eventinfo = mysql_real_escape_string($_POST['eventinfo']); $date = mysql_real_escape_string($_POST['date']); $time = mysql_real_escape_string($_POST['time']); $livetickets = mysql_real_escape_string($_POST['sale']); $numtickets = mysql_real_escape_string($_POST['numtickets']); $pricestudents = mysql_real_escape_string($_POST['studentsprice']); $priceseniors = mysql_real_escape_string($_POST['seniorsprice']); $priceadults = mysql_real_escape_string($_POST['adultsprice']); $venues = mysql_real_escape_string($_POST['venue']); $categorys = mysql_real_escape_string($_POST['category']); $sqlCommand = "UPDATE events SET eventname='$eventname', typeevent='$eventtype', eventinfo='$eventinfo', date='$date', time='$time', sale='$livetickets', numtickets='$numtickets', studentsprice='$pricestudents', seniorsprice='$priceseniors', adultsprice='$priceadults', venue='$venues', category='$categorys' WHERE id='$newid'"; $out = mysql_query($sqlCommand); echo "SAVE CHANGES COMPLETED!"; } ?> Hi, I am trying to take the concatenated option value from my form and send it via email broken into the individual pieces. For example, in my code to follow... the ID field is the key field that generates what you see in the drop down list (Date, Site, Price). What I want to be able to do is separate (or un-concatenate, for lack of a better word) the values $Date, $Site, $Price so when the customer receives the email it reads this way because right now it only gives me the ID field (RID) to send via email... Date: 5/29-6/3/11 Site: Carterville Price: $1150.00 .... Any ideas on how to do this? Here is the code from my form..... Code: [Select] <?php $q=$_GET["q"]; $con = mysql_connect('my-host', 'my_user', 'my_pwd'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("my_db", $con); $sql="SELECT * FROM daterange WHERE DEND > DATE(NOW()) AND STATUS='A' AND MONTH = '".$q."' ORDER BY RID, DATE, SITE"; $result = mysql_query($sql); // Determine the number of reservation dates $number = mysql_numrows($result); // Create drop-down menu of reservation dates print "<font size=\"3\" face=\"Arial\"><b>Select Your Reservation:</b><br> <form action=\"resersend.php\" method=\"post\"> <select name=\"RID\"> <option value=\"\">Choose One</option>"; for ($i=0; $i<$number; $i++) { $RID = mysql_result($result,$i,"RID"); $DATE = mysql_result($result,$i,"DATE"); $SITE = mysql_result($result,$i, "SITE"); $PRICE = mysql_result($result,$i, "PRICE"); print "<option value=\"$RID\">$DATE, $SITE, $PRICE</option>"; } print "</select><p align=left><label><font size=\"3\" face=\"Arial\">First Name: <input type=\"text\" name=\"FNAME\" size=\"50\" maxlength=\"50\" tabindex=\"1\"<br>"; print "<p align=left><label>Last Name: <input type=\"text\" name=\"LNAME\" size=\"50\" maxlength=\"50\" tabindex=\"2\"<br>"; print "<p align=left><label>Address Line 1: <input type=\"text\" name=\"ADDR1\" size=\"50\" maxlength=\"50\" tabindex=\"3\"<br>"; print "<p align=left><label>Address Line 2: <input type=\"text\" name=\"ADDR2\" size=\"50\" maxlength=\"50\" tabindex=\"4\"<br>"; print "<p align=left><label>City: <input type=\"text\" name=\"CITY\" size=\"50\" maxlength=\"50\" tabindex=\"5\"<br>"; print "<p align=left><label>State (abbrev.): <input type=\"text\" name=\"STATE\" size=\"2\" maxlength=\"2\" tabindex=\"6\"<br>"; print "<p align=left><label>Zip Code: <input type=\"text\" name=\"ZIP\" size=\"5\" maxlength=\"5\" tabindex=\"7\"<br>"; print "<p align=left><label>Contact Phone Number: (<input type=\"text\" name=\"PHONE1\" size=\"3\" maxlength=\"3\" tabindex=\"8\""; print "<label>)<input type=\"text\" name=\"PHONE2\" size=\"3\" maxlength=\"3\" tabindex=\"9\""; print "<label>-<input type=\"text\" name=\"PHONE3\" size=\"4\" maxlength=\"4\" tabindex=\"10\"<br>"; print "<p align=left><label>Email: <input type=\"text\" name=\"EMAIL\" size=\"50\" maxlength=\"50\" tabindex=\"11\"<br>"; print "<p align=left><input type=\"submit\" value=\"Book Now!\" name=\"submit\">"; print "<input type=\"reset\" value=\"reset\" name=\"reset\"></form>"; // Close the database connection mysql_close($con); ?> I am adding to a shopping cart using sessions, when I add a product with a selected size it echoes the correct size as text but when applying it to my option boxes as selected, it just shows the last item in the select box. here is the code for the session variables <?php for ($basket_counter=0;$basket_counter<$_SESSION['ses_basket_items'];$basket_counter++) { $price=sprintf("%01.2f",$ses_basket_price[$basket_counter]); $quantity=$ses_basket_amount[$basket_counter]; $code=$ses_basket_stockcode[$basket_counter]; $itemID=$ses_basket_id[$basket_counter]; $name=$ses_basket_name[$basket_counter]; $image=$ses_basket_image[$basket_counter]; $size=$ses_basket_size[$basket_counter]; $sizechoice=$ses_basket_sizechoice[$basket_counter]; // create array from sizes and make the option box selections if ($sizechoice!="" && (!in_array($sizechoice, array('One Size', 'one size', 'free size', 'Free Size', 'Adjustable', 'adjustable')))) { // add size trigger $sizelist="add"; //create the array $sizepick=explode(",", $sizechoice); } else { $sizepick=$sizechoice; } // adjust gst for AU customers if ($country='AU') { $price=sprintf("%01.2f",($price*1.1)); $unit=sprintf("%01.2f",($price/$quantity)); } else { $unit=sprintf("%01.2f",($price/$quantity)); } ?> and this bit inside the same loop displayes the select box for size <?php if ($sizelist && $sizelist='add') { echo "<select name='size' id='size' style='vertical-align:middle;'>"; foreach($sizepick AS $sizes) { if ($sizes==$size) { echo "<option value='$size' selected='selected'>$size</option>"; } else { echo "<option value='$sizes'>$sizes</option>"; }} echo "</select>"; } else { echo $size; } ?> appreciate any help on this Hey guys, i have a small problemo. As you can see i have made an option list from 0 to 3. How can I put this optionlist in a for loop so I can save some place? I have found an example but I dont know how to integrate it in my php Example Code: [Select] for( $i = 0; $i < 4; $i++ ) { $optionlist .= "<option value=\"$i\">$i</option>\n"; } $optionlist .= "</select>\n"; Code: [Select] <?php $dranken = array("cola", "fanta", "bier", "koffie", "thee"); $prijzen = array("2", "2", "1.80", "2.20", "2.20"); $i = 0; echo "<table>"; while ($dranken[$i]) { $listnaam = $dranken[$i] . "_aantal"; $optionlist = "<select name= '$listnaam'><option>0</option><option>1</option><option>2</option><option>3</option></select>"; echo "<tr><td >" . $dranken[$i] . "</td>"; echo "<td>" . $prijzen[$i] . "</td>"; echo "<td>" . $optionlist . "</td></tr>"; $i++; } echo "</table>"; ?> thanks i have a basic html form with a drop down selection box with 2 options ('old' and 'new'). when you click one it swaps them round to you can click the other because it is an onchange event. <form action="<?php $_SERVER['self']; ?>" method="get"> <select name="Time" onchange="this.form.submit();"> <option value="New">New</option> <option value="Old">Old</option> </select></form> ok so below is the select option for my form i creatig should this select have the name 0f bday form of the three selects so that when i put it into a variable it could just be $birthday = $_POST = ['bday']; Code: [Select] <select class="drop" name="bday"> <option>Month</option> <option value="1">January</option> <option value="2">February</option> <option value="3">March</option> <option value="4">April</option> <option value="5">May</option> <option value="6">June</option> <option value="7">July</option> <option value="8">August</option> <option value="9">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> <select class="drop" name="bday"> <option>Day</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> <select class="drop" name="bday"> <option>Year</option> <option value="2011">2011</option> <option value="2010">2010</option> <option value="2009">2009</option> <option value="2008">2008</option> <option value="2007">2007</option> <option value="2006">2006</option> <option value="2005">2005</option> <option value="2004">2004</option> <option value="2003">2003</option> <option value="2002">2002</option> <option value="2001">2001</option> <option value="2000">2000</option> <option value="1999">1999</option> <option value="1998">1998</option> <option value="1997">1997</option> <option value="1996">1996</option> <option value="1995">1995</option> <option value="1994">1994</option> <option value="1993">1993</option> <option value="1992">1992</option> <option value="1991">1991</option> <option value="1990">1990</option> <option value="1989">1989</option> <option value="1988">1988</option> <option value="1987">1987</option> <option value="1986">1986</option> <option value="1985">1985</option> <option value="1984">1984</option> <option value="1983">1983</option> <option value="1982">1982</option> <option value="1981">1981</option> <option value="1980">1980</option> <option value="1979">1979</option> <option value="1978">1978</option> <option value="1977">1977</option> <option value="1976">1976</option> <option value="1975">1975</option> <option value="1974">1974</option> <option value="1973">1973</option> <option value="1972">1972</option> <option value="1971">1971</option> <option value="1970">1970</option> <option value="1969">1969</option> <option value="1968">1968</option> <option value="1967">1967</option> <option value="1966">1966</option> <option value="1965">1965</option> <option value="1964">1964</option> <option value="1963">1963</option> <option value="1962">1962</option> <option value="1961">1961</option> <option value="1960">1960</option> <option value="1959">1959</option> <option value="1958">1958</option> <option value="1957">1957</option> <option value="1956">1956</option> <option value="1955">1955</option> <option value="1954">1954</option> <option value="1953">1953</option> <option value="1952">1952</option> <option value="1951">1951</option> <option value="1950">1950</option> <option value="1949">1949</option> <option value="1948">1948</option> <option value="1947">1947</option> <option value="1946">1946</option> <option value="1945">1945</option> <option value="1944">1944</option> <option value="1943">1943</option> <option value="1942">1942</option> <option value="1941">1941</option> <option value="1940">1940</option> <option value="1939">1939</option> <option value="1938">1938</option> <option value="1937">1937</option> <option value="1936">1936</option> <option value="1935">1935</option> <option value="1934">1934</option> <option value="1933">1933</option> <option value="1932">1932</option> <option value="1931">1931</option> <option value="1930">1930</option> <option value="1929">1929</option> <option value="1928">1928</option> <option value="1927">1927</option> <option value="1926">1926</option> <option value="1925">1925</option> <option value="1924">1924</option> <option value="1923">1923</option> <option value="1922">1922</option> <option value="1921">1921</option> <option value="1920">1920</option> <option value="1919">1919</option> <option value="1918">1918</option> <option value="1917">1917</option> <option value="1916">1916</option> <option value="1915">1915</option> <option value="1914">1914</option> <option value="1913">1913</option> <option value="1912">1912</option> <option value="1911">1911</option> <option value="1910">1910</option> <option value="1909">1909</option> <option value="1908">1908</option> <option value="1907">1907</option> <option value="1906">1906</option> <option value="1905">1905</option> <option value="1904">1904</option> <option value="1903">1903</option> <option value="1902">1902</option> <option value="1901">1901</option> <option value="1900">1900</option> </select> I have a Payment Form that has become rather complex, and I think it's time to hand things off to another page?! Here is the gist of my form... Code: [Select] <?php session_start(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head></head> <body> <?php // Initialize variables. // ********************************************************************* // HANDLE FORM. // ********************************************************************* if (isset($_POST['submitted'])){ // Initialize Errors Array. $errors = array(); // ******************** // CHECK FORM DATA. * // ******************** // Determine if any errors. if (empty($errors)){ // ********************************************************************* // PROCESS PAYMENT. // ********************************************************************* //@@@@@@@@@@@ START AUTHORIZE.NET CODE @@@@@@@@@@@@@@@@@ // Use HTTP POST to send form data. curl_setopt($request, CURLOPT_POSTFIELDS, $post_string); // Print Response Code. switch($response_array[0]){ case "1": $responseCode = 'Approved'; break; case "2": $responseCode = 'Declined'; break; case "3": $responseCode = 'Error (Please contact Customer Service.)'; break; case "4": $responseCode = 'Held for Review (Please contact Customer Service.)'; break; } echo "<br />Response Code: " . $responseCode . "<br />"; //@@@@@@@@@@@ END AUTHORIZE.NET CODE @@@@@@@@@@@@@@@@@@ // Do not return to Payment Form!!! exit(); // ********************************************************************* }// End of PROCESS PAYMENT. }// End of HANDLE FORM. ?> <!-- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ --> <!-- HTML PAYMENT FORM --> <form id="payment" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> </form> </body> </html> In fairness, this actually isn't the entire page - it is just the HTML Form and PHP Handling Script... The entire page will also have a Header and Footer, and is why I am asking for help. As my code works no, after the form is submitted, the user sees a white screen with only a Response Message. How can I redirect the user to another page which has my website's Header and Footer and a more personalized message?? (I could technically echo a boat-load of HTML in the IF-THEN-ELSE after the form is submitted, but that seems excessive. So a page re-direct seems to make more sense...) Thanks, Debbie Evening People I have this drop downbox on a HTML page, it is populated from a PHP page, if the user makes a selection i want that selection to be retained once the page refreshed. What i have is while ($row = $db->sql_fetchrow($result)) { if(isset($_GET["REGION_FILTER"]) AND $_GET["REGION_FILTER"] = $row['region'] AND strlen($_GET["REGION_FILTER"]) > 0) //if($region_filter = $row['region'] AND strlen($region_filter) > 0) { $region_filter_options .= '<option value="' . $row['region'] . '" SELECTED>' . $row['region'] . '</option>'; } else { $region_filter_options .= '<option value="' . $row['region']. '">' . $row['region'] . '</option>'; } } REGION_FILTER is the ID of the option box The drop down box is populated from the database but i cant seem to get the selected bit working. Can someone help identify what i have done wrong ? regards |