PHP - Form Fields, Checkboxes, And Radio Button Lose Data On Refresh
Similar TutorialsI have page with male female radio button Here's the code Code: [Select] $qry=mysql_query("SELECT * FROM reg_table where id=$id "); $res=mysql_fetch_array($qry); $radio = $res['gender']; switch($radio) { case "male": $mal = "checked"; break; case "female": $fem = "checked"; break; } Code: [Select] Gender: <br /> <input type="radio" name="colour" value="male" checked="<?php $mal; ?>" />Male <input type="radio" name="colour" value="female" checked="<?php $fem; ?>" />Female Whats the use of checked in <input type="radio" name="colour" value="male" checked="<?php $mal; ?>" /> The below should choose the radio button that is set by the $_SESSION variable or default to 3. However, it's defaulting to 1. Code: [Select] $content.=' <p class="form_item"><label>Product Rating:</label><br /> <div class="rating_radio"><input type="radio" name="review_product_rating" value="1"'; if(isset($review_product_rating) && $review_product_rating=="1"){$content.='checked';} $content.=' /> <br />1</div> <div class="rating_radio"><input type="radio" name="review_product_rating" value="2"'; if(isset($review_product_rating) && $review_product_rating=="2"){$content.='checked';} $content.=' /> <br />2</div> <div class="rating_radio"><input type="radio" name="review_product_rating" value="3"'; if(isset($review_product_rating) && $review_product_rating=="3" || !isset($review_product_rating)){$content.='checked';} $content.=' /> <br />3</div> <div class="rating_radio"><input type="radio" name="review_product_rating" value="4"'; if(isset($review_product_rating) && $review_product_rating=="4"){$content.='checked';} $content.=' /> <br />4</div> <div class="rating_radio"><input type="radio" name="review_product_rating" value="5"'; if(isset($review_product_rating) && $review_product_rating=="5"){$content.='checked';} $content.=' /> <br />5</div> <div class="worst">(Worst)</div><div class="best">(Best)</div> </p> I'm figuring it's because it's multiple if statement (with no elseif) so it's evaluating the first if and being set to true. I tried changing everything else after the first one to elseif, and it's throwing an unexpected T_ELSEIF error. I'm in the process of making a network for investors and entrepreneurs. When they access their profile page, select edit and go to editprofile.php a problem arises with the data base submission. I have the data they have previously inputted being echoed back out to the user. This lets the user see what they have inputted so that they can make changes to their profile. Unfortunately, with my radio buttons, if no changes are made and the user hits submit, the radio buttons return a value of 'unchecked'. I need them to maintain the value previously submitted to the database if the radio button isn't 'checked'. I'm not sure exactly how to do this. You can test it out yourself by going to http://network.jasonbiondo.com Code is below: Code: [Select] ?php session_start(); require ('connect.php'); include ('header.php'); $savechanges = $_POST['savechanges']; $firstname = strip_tags($_POST['firstname']); $lastname = strip_tags($_POST['lastname']); $username = strtolower(strip_tags($_POST['username'])); $email = strip_tags($_POST['email']); $password = strip_tags($_POST['password']); $repeatpassword = strip_tags($_POST['repeatpassword']); $entrepreneur = 'unchecked'; $investor = 'unchecked'; $date = date("Y-m-d"); $companyname = strip_tags($_POST['companyname']); $companywebsite = strip_tags($_POST['companywebsite']); $founder = strip_tags($_POST['founder']); $phone = strip_tags($_POST['phone']); $address = strip_tags($_POST['address']); $city = strip_tags($_POST['city']); $state = strip_tags($_POST['state']); $zipcode = strip_tags($_POST['zipcode']); $country = strip_tags($_POST['country']); $development = strip_tags($_POST['development']); $capitalamount = strip_tags($_POST['capitalamount']); $companydo = strip_tags($_POST['companydo']); $founderbuilt = strip_tags($_POST['founderbuilt']); $whatsnew = strip_tags($_POST['whatsnew']); $understand = strip_tags($_POST['understand']); $competition = strip_tags($_POST['competition']); $money = strip_tags($_POST['money']); $demo = strip_tags($_POST['demo']); $incorporation = strip_tags($_POST['incorporation']); $companynameinv = strip_tags($_POST['companynameinv']); $phoneinv = strip_tags($_POST['phoneinv']); $addressinv = strip_tags($_POST['addressinv']); $cityinv = strip_tags($_POST['cityinv']); $stateinv = strip_tags($_POST['stateinv']); $zipcodeinv = strip_tags($_POST['zipcodeinv']); $countryinv = strip_tags($_POST['countryinv']); $angel = strip_tags($_POST['angel']); $vc = strip_tags($_POST['vc']); $capital = strip_tags($_POST['capital']); if ($savechanges) { $queryreg = mysql_query("UPDATE users SET `firstname` = '$firstname', `lastname` = '$lastname', `email` = '$email', `entrepreneur` = '$entrepreneur', `investor` = '$investor', `companyname` = '$companyname', `companywebsite` = '$companywebsite', `founder` = '$founder', `phone` = '$phone', `address` = '$address', `city` = '$city', `state` = '$state', `zipcode` = '$zipcode', `country` = '$country', `development` = '$development', `capitalamount` = '$capitalamount', `companydo` ='$companydo', `founderbuilt` = '$founderbuilt', `whatsnew` = '$whatsnew', `understand` = '$understand', `competition` = '$competition', `money` = '$money', `demo` = '$demo', `incorporation` = '$incorporation', `companynameinv` = '$companynameinv', `phoneinv` = '$phoneinv', `addressinv` = '$addressinv', `cityinv` = '$cityinv', `stateinv` = '$stateinv', `zipcodeinv` = '$zipcodeinv', `countryinv` = '$countryinv', `angel` = '$angel', `vc` = '$vc', `capital` = '$capital' WHERE username= '" . $_SESSION['username'] . "' "); $selected_radio_selector = $_POST['selector']; $selected_radio_invtype = $_POST['invtype']; if ($selected_radio_selector == 'entrepreneur') { $entrepreneur = 'checked'; } else if ($selected_radio_selector == 'investor') { $investor = 'checked'; if ($selected_radio_invtype == 'angel') { $angel = 'checked'; $vc = 'unchecked'; } else if ($selected_radio_invtype == 'vc') { $vc = 'checked'; $angel = 'unchecked'; } else { die("Please select what type of investor you are!"); } } } $q = mysql_query("SELECT `firstname`, `lastname`, `firstname`, `lastname`, `email`, `entrepreneur`, `investor`, `companyname`, `companywebsite`, `founder`, `phone`, `address`, `city`, `state`, `zipcode`, `country`, `development`, `capitalamount`, `companydo`, `founderbuilt`, `whatsnew`, `understand`, `competition`, `money`, `demo`, `incorporation`, `companynameinv`, `phoneinv`, `addressinv`, `cityinv`, `stateinv`, `zipcodeinv`, `countryinv`, `angel`, `vc`, `capital` FROM `users` WHERE username= '" . $_SESSION['username'] . "'"); $r = mysql_fetch_assoc($q); ?> <script type="text/javascript" src="../assets/js/editprofile.js"></script> <form action='editprofile.php' method="POST" id="form"> <fieldset> <p id="required"> * Required Fields</p> <p class="fieldSpacing"> <label for="firstname" class="leftcolalign">First Name *</label> <input id="firstname" class="rightcolalign" name="firstname" value='<?php echo $r['firstname']; ?>'/> </p> <p class="fieldSpacing"> <label for="lastname" class="leftcolalign">Last Name *</label> <input id="lastname" class="rightcolalign" name="lastname" value='<?php echo $r['lastname'];?>'/> </p> <p class="fieldSpacing"> <label for="username" class="leftcolalign">User Name *</label> <?php echo $_SESSION['username']; ?> </p> <p class="fieldSpacing"> <label for="email" class="leftcolalign">Email *</label> <input id="email" class="rightcolalign" name="email" value='<?php echo $r['email']; ?>''/> </p> <p class="fieldSpacing"> <label for="selector" class="leftcolalign">What am I? *</label> <input id="entButton" class="radioalign" type="radio" name="selector" value="entrepreneur"<?php echo $r['entrepreneur']; ?>/> <label for="entrepreneur" id="entrepreneur">Entrepreneur</label> <input id="invButton" class="radioalign" type="radio" name="selector" value="investor"<?php echo $r['investor']; ?>/> <label for="investor" id="investor">Investor</label> </p> </fieldset> <fieldset id="entForm"> <p class="fieldSpacing"> <label for="companyname" class="leftcolalign">Company Name: *</label> <input id="companyname" class="rightcolalign" name="companyname" value='<?php echo $r['companyname']; ?>'/> </p> <p class="fieldSpacing"> <label for="companywebsite" class="leftcolalign">Company Website:</label> <input id="companywebsite" class="rightcolalign" name="companywebsite" value='<?php echo $r['companywebsite']; ?>'/> </p> <p class="fieldSpacing"> <label for="founder" class="leftcolalign">Founder(s): *</label> <input id="founder" class="rightcolalign" name="founder" value='<?php echo $r['founder']; ?>'/> </p> <p class="fieldSpacing"> <label for="phone" class="leftcolalign">Phone Number(s): *</label> <input id="phone" class="rightcolalign" name="phone" value='<?php echo $r['phone']; ?>'/> </p> <p class="fieldSpacing"> <label for="address" class="leftcolalign">Address: *</label> <input id="address" class="rightcolalign" name="address" value='<?php echo $r['address']; ?>'/> </p> <p class="fieldSpacing"> <label for="city" class="leftcolalign">City: *</label> <input id="city" class="rightcolalign" name="city" value='<?php echo $r['city']; ?>'/> </p> <p class="fieldSpacing"> <label for="state" class="leftcolalign">State:</label> <input id="state" class="rightcolalign" name="state" value='<?php echo $r['state']; ?>'/> </p> <p class="fieldSpacing"> <label for="zipcode" class="leftcolalign">Zip Code:</label> <input id="zipcode" class="rightcolalign" name="zipcode" value='<?php echo $r['zipcode']; ?>'/> </p> Hey in my edit page i have 2 radio buttons in my form and i need to make sure the same value is still selected how can i do that? thanks When I submitted my Form & refresh then browser resend all data again into database, So anybody know any solution of this to avoid data resend after refreshing browser.. Hi people,
I'm new to PHP, and I'm having some real difficulties with trying to re-populate a radio button selection on a form.
Basically, I'm working on a WordPress plugin which uses custom fields to create a Bet custom post type.
I need to have my form submit the user input, then re-populate it so that if the user wants to edit and update the Bet data, they don't have to fill in the whole form details again, they can just edit what they need to, and update (re-submit) the form.
I've managed to get all of the form elements re-populating, apart from a radio button. I've been trawling round the internet for most of yesterday evening and this morning, trying different things, but nothing I've found works for me.
I'd really appreciate some help if anyone knows how to do this.
Here's my code so far (non working)
<?php Hi i am working one of my assignment for school.. i just studied php.. my problem is, is it possible to load another form once i clicked a radio button? if its a yes... can you teach me how to do that? thank you! Just a quick help here... When you click click this radio button. <input type="radio" name="radio" id="radio_id_card" /> ID Card it will open the form below the radio button. <form> First Name: <input type="text" name="textfield" id="textfield" /> Last Name: <input type="text" name="textfield" id="textfield" /> <input type="submit" id="Send" value="Submit" /> </form> ------------------------------- hope someone can help me... i really have a bad time thinking of ways to do it.. thank you in advance.. hi, I would like to know how do i modify this code if i Have more than 1 option in my dropdown list. Can someone help..Thankz <select name="mediaList" id="mediaList"> <option <?php echo ($rows['media_type'] =='Physical Only')?'selected="Selected"':'';?> >Physical Only</option> </select> The ID field doesn't display the data but it must be there because it was the key for the query. It is an int if that makes any difference. <html> <head> </head> <body> <?php // Connect to database===================================================== include("connect_db.php"); // retrieve form data ====================================================== $id = $_POST['id']; // sending query =========================================================== $query = "SELECT ama,model_name,model_mfg,wingspan,engine,decibels FROM airplanes WHERE id='$id'"; if( !$result = mysql_query($query) ) { echo "<br>Query $query<br>Failed with error: " . mysql_error() . '<br>'; } else { $fetch = mysql_fetch_array( $result ); } // Output form with retrieved data ========================================== ?> <h3>Change the data and then click the CHANGE button</h3><br> <form name="Form51" action="update_db_airplane.php" method="post"> ID #:<input type="text" name="id" value="<?=$fetch[id]?>" /><br> AMA #:<input type="text" name="ama" value="<?=$fetch[ama]?>" /><br> Model Name:<input type="text" name="model_name" value="<?=$fetch[model_name]?>" /><br> Model Mfg:<input type="text" name="model_mfg" value="<?=$fetch[model_mfg]?>" /><br> Wingspan:<input type="text" name="wingspan" value="<?=$fetch[wingspan]?>" /><br> Engine:<input type="text" name="engine" value="<?=$fetch[engine]?>" /><br> Decibels:<input type="text" name="decibels" value="<?=$fetch[decibels]?>" /><br><br> <input name="submit" id="submit" value="CHANGE!" type="submit"> </form> <br> <body> </html> Ok from one brick wall to the next. After lots of help with my last query I moved onto the next task an I'm completely stuck again. I have a form thats created with a loop. Here is that form <form action="" method="post" id=""> <?php for ($i = 1; $i <= $totalRows_rs_cacheNum; $i++) { echo "<label>Cache ".$i."</label> <span id='sprytextfield".$i."'> <input name='cache[$i]' type='text' value='".$_POST['cache[$i]']."'/> <span class='textfieldRequiredMsg'>Required!</span></span> <div class='clear'></div>"; } ?> <input name="nextbtn" type="submit" value="Next" /> When a user enters data in all the fields, If one piece of information is incorrect an error pops up saying one of the fields you entered does not match the fields in the database. At the same time however i wish to keep the data they have entered in each of the fields. Normally you'd just write value="<?php echo $_POST['fieldName'];?>" but for some reason in this case it does not work. can someone point me in the right direction. I've tried Google many different terms but I can not find the correct term to find my answer. Hence me asking you guys again. Thanks I'm developing a form which is essentially a simple set of radio buttons. Conceptually, it is like this:
Please select a theme from the list:
o Black
o Blue
o Red
[Submit] [Reset]
I'm actually showing a slideshow of images showing the appearance of each of the themes in a slideshow that only shows one image at a time. I want my users to click on the image that represents the theme they want and, ideally, not have to click on the Submit button at all.
Then I will save the name of the theme they chose in a cookie (if cookies are enabled).
Many years ago, I dabbled in things like CGI and I have a vague recollection, possibly faulty, that it's not difficult to make a form that has only one set of radio buttons treat the selection of one of the radio buttons as a Submit. I don't remember how to do it though.
Can anyone advise me on whether it is indeed possible and, if it is, how I make the selection of the radio button cause the form to be submitted?
Hi guys! New to the community and hope to learn a lot here! Here is some background info and what I want to do, and what I know. I have been building websites for years, and I am familiar with Actionscript 3.0. And I have successful ran a few wordpress websites. What I am trying to do right now however is modify this form script I found, to only email the data when the field isn't left blank. It's stumping me because the actual "message" that ends up being the body of the email is a variable. And form what I can tell I can't figure out how to put if statements into it. If anyone can take a look at this script and give me any pointers you would be awesome. Code: [Select] <?php //trying to store the date in a separate variable only when it's not blank if ($_POST['starttime'] == '') { //nothing; } else { $showStartTime == "Start time: " . $_POST['starttime'] . ""; } if ($_POST['finishtime'] == '') { //nothing; } else { $showFinishTime == "Finish time: " . $_POST['finishtime'] . ""; } // Read POST request params into global vars $to = $_POST['to']; $from = $_POST['from']; $name = $_POST['name']; $company = $_POST['company']; $newcustomer = $_POST['newcustomer']; $address1 = $_POST['address1']; $address2 = $_POST['address2']; $subject = ("Event Rental for " . $name . ""); $description = $_POST['description']; $phone = $_POST['phone']; $message = (" Name: " . $name . " Company or Organization: " . $company . " Phone Number: " . $phone . " Email Address: " . $from . " Street Address: " . $address1 . " " . $address2 . " New Customer: " . $newcustomer . " Customer From: " . $_POST['howyouheard'] . " Interested in: SkyLoft " . $_POST['whichspace'] . " Date: " . $_POST['date'] . " Day of Week: " . $_POST['dayofweek'] . " " . $showStartTime . " " . $showFinishTime . " Number of Guests: " . $_POST['Guests'] . " Format: " . $_POST['format'] . " Occasion: " . $_POST['Occasion'] . " Optional Needs: " . $_POST['dj'] . " " . $_POST['tables'] . " " . $_POST['chairs'] . " " . $_POST['eventbanner'] . " " . $_POST['pasoundsystem'] . " Message: " . $description . " "); // Obtain file upload vars $fileatt = $_FILES['fileatt']['tmp_name']; $fileatt_type = $_FILES['fileatt']['type']; $fileatt_name = $_FILES['fileatt']['name']; $headers = "From: $from"; if (is_uploaded_file($fileatt)) { // Read the file to be attached ('rb' = read binary) $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); // Generate a boundary string $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; // Add the headers for a file attachment $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; // Add a multipart boundary above the plain message $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; // Base64 encode the file data $data = chunk_split(base64_encode($data)); // Add file attachment to the message $message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n"; } // Send the message $ok = @mail($to, $subject, $message, $headers); if ($ok) { echo "<p><b>Thank you for your interest in SkyLofts!</b> <br>You should recieve a verification in your inbox that we recieved your request. We will contact you as soon as possible and hopefully be able to answer any questions you may have! You can also contact us via phone 410-791-6699, or toll-free 1-800-344-0410.</p>"; } else { echo "<p>There was an error when processing your request. Please try again.</p>"; } ?> Below is my code. I am having an issue with the form printing the Gender to an e-mail that it sends. I can't figure out what I am missing. Everything else works fine. I also need to have a list of check boxes that more than one can be selected like What kind of music do you like? Rock Pop ETC Any help with this would be greatly appreciated Thank you Gary Code below ----------------------------------------------------------------------------------------- <?php $your_email ='email@emailaddress.com';// <<=== update to your email address session_start(); $errors = ''; $name = ''; $visitor_email = ''; $user_message = ''; if(isset($_POST['submit'])) { $name = $_POST['name']; $visitor_email = $_POST['email']; $visitor_q1 = $_POST['q1']; $user_message = $_POST['message']; ///------------Do Validations------------- if(empty($name)||empty($visitor_email)) { $errors .= "\n Name and Email are required fields. "; } if(IsInjected($visitor_email)) { $errors .= "\n Bad email value!"; } if(empty($_SESSION['6_letters_code'] ) || strcasecmp($_SESSION['6_letters_code'], $_POST['6_letters_code']) != 0) { //Note: the captcha code is compared case insensitively. //if you want case sensitive match, update the check above to // strcmp() $errors .= "\n The captcha code does not match!"; } if(empty($errors)) { //send the email $to = $your_email; $subject="New form submission"; $from = $your_email; $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''; $body = "A user $name submitted the contact form:\n". "Full Name: $name\n". "Email: $visitor_email \n". "Gender: $gender \n". "Q1: $visitor_q1 \n". "Message: \n ". "$user_message\n". "IP: $ip\n"; $headers = "From: $from \r\n"; $headers .= "Reply-To: $visitor_email \r\n"; mail($to, $subject, $body,$headers); header('Location: thank-you.html'); } } // Function to validate against any email injection attempts function IsInjected($str) { $injections = array('(\n+)', '(\r+)', '(\t+)', '(%0A+)', '(%0D+)', '(%08+)', '(%09+)' ); $inject = join('|', $injections); $inject = "/$inject/i"; if(preg_match($inject,$str)) { return true; } else { return false; } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> <META name="description" content="Voice Lessons with Richard Fink IV world wide via Skype and iChat. Vocal studio located near Rochester NY."> <META name="keywords" content="rates, cost, vocal, teacher, coach, voice, private, lessons, rochester, ny, skype, ichat, new york city, los angels, las vegas, nyc, la, artist, pop, r&b, rock, country, metal"> <META NAME="GENERATOR" Content="Visual Page 2.0 for Windows"> <TITLE>Frequently Asked Questions | Vocal Coach | Castle Nine Vocal Studios</TITLE> <style type="text/css"> <!-- body,td,th { color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: medium; } body { background-color: #FFFFFF; } .style9 {font-size: 14px} .style18 {font-size: 25px; color: #330033; } .style20 {font-size: 24px} .style21 { font-size: 12px; font-style: italic; } .style23 {color: #000000} .style10 {color: #330033} .style11 { color: #330033; font-weight: bold; } --> </style> <style> label,a, body { font-family : Arial, Helvetica, sans-serif; font-size : 12px; } .err { font-family : Verdana, Helvetica, sans-serif; font-size : 12px; color: red; } </style> <script type="text/JavaScript"> <!-- function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <script language="JavaScript" src="scripts/gen_validatorv31.js" type="text/javascript"></script> </HEAD> <BODY LINK="#330066" VLINK="#330066" ALINK="red" onLoad="MM_preloadImages('images/pdalinkbio2.jpg','images/pdalinkhome2.jpg','images/pdalinkvocal2.jpg','images/pdalinkphotos2.jpg','images/pdalinktest2.jpg','images/pdalinkfaq2.jpg')"> <CENTER> <table border="0" align="center" cellpadding="5"> <tr> <td width="647" height="817" bgcolor="#CCCCCC"><table width="647" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="647" align="center" valign="top" bgcolor="#FFFFFF"><div align="center"><img src="images/pdaheading.jpg" width="647" height="158"><a href="http://www.richardiv.com/index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image11','','images/pdalinkhome2.jpg',1)"><img src="images/pdalinkhome.jpg" name="Image11" width="61" height="16" border="0"></a><a href="http://www.richardiv.com/richardfinkiv.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image10','','images/pdalinkbio2.jpg',1)"><img src="images/pdalinkbio.jpg" name="Image10" width="110" height="16" border="0"></a><a href="http://www.richardiv.com/voicelessons.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image12','','images/pdalinkvocal2.jpg',1)"><img src="images/pdalinkvocal.jpg" name="Image12" width="145" height="16" border="0"></a><a href="http://www.richardiv.com/photos.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image13','','images/pdalinkphotos2.jpg',1)"><img src="images/pdalinkphotos.jpg" width="146" height="16" border="0"></a><a href="http://www.richardiv.com/testimonials.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image14','','images/pdalinktest2.jpg',1)"><img src="images/pdalinktest.jpg" name="Image14" width="130" height="16" border="0"></a><a href="http://www.richardiv.com/faq.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image15','','images/pdalinkfaq2.jpg',1)"><img src="images/pdalinkfaq.jpg" name="Image15" width="55" height="16" border="0"></a><span class="style18"><br> </span><br> </div></td> </tr> <tr> <td height="601" bgcolor="#FFFFFF"><table width="644" border="0" align="center" cellpadding="5"> <tr> <td width="630" height="597"><p align="justify" class="style9"><span class="style18"><span class="style20"><span class="style23"><?php if(!empty($errors)){ echo "<p class='err'>".nl2br($errors)."</p>"; } ?> <div id='contact_form_errorloc' class='err'></div> <form method="POST" name="contact_form" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>"> <p> <label for='name'>Full Name: </label><br> <input type="text" name="name" value='<?php echo htmlentities($name) ?>'> </p> <p> <label for='email'>Email: </label><br> <input type="text" name="email" value='<?php echo htmlentities($visitor_email) ?>'> <p> <p> <label for='q1'>Q1: </label><br> <input type="text" name="q1" value='<?php echo htmlentities($visitor_q1) ?>'> <p> <p> <label for='gender'>Male: </label> <input type="radio" name="Gender" value='<?php echo htmlentities($male) ?>'/> <br /> <label for='Gender'>Female:</label> <input type="radio" name="Gender" value='<?php echo htmlentities($female) ?>'/> <br /> </p> <p> <label for='message'>Message:</label> <br> <textarea name="message" rows=8 cols=30><?php echo htmlentities($user_message) ?></textarea> </p> <p> <img src="captcha_code_file.php?rand=<?php echo rand(); ?>" id='captchaimg' ><br> <label for='message'>Enter the code above here :</label><br> <input id="6_letters_code" name="6_letters_code" type="text"><br> <small>Can't read the image? click <a href='javascript: refreshCaptcha();'>here</a> to refresh</small> </p> <input type="submit" value="Submit" name='submit'> </form></i><br> <br> <br> <br> </p> </td> </tr> </table> </td> </tr> <tr> <td><img src="images/pdabase.jpg" width="647" height="48" border="0" usemap="#Map2"></td> </tr> </table> </td> </tr> </table> </CENTER> <map name="Map"><area shape="rect" coords="514,43,633,70" href="richard_fink_iv/voicelessons.htm"> <area shape="rect" coords="514,74,637,96" href="richard_fink_iv/photo.htm"> <area shape="rect" coords="529,101,637,124" href="richard_fink_iv/testimonials.htm"> <area shape="rect" coords="581,128,638,150" href="richard_fink_iv/faq.htm"> <area shape="rect" coords="152,52,462,113" href="richard_fink_iv/mobileindex.html"> </map> <map name="Map2"><area shape="rect" coords="462,7,503,46" href="http://www.facebook.com/pages/Richard-Fink-IV-Vocal-Coach/165219796824660"> <area shape="rect" coords="509,5,550,47" href="http://www.myspace.com/richardfinkiv"> <area shape="rect" coords="558,6,596,48" href="http://www.twitter.com/richardfinkiv"> <area shape="rect" coords="607,6,647,47" href="http://www.youtube.com/richardfinkiv"> </map> <map name="Map3"><area shape="rect" coords="-5,-1,129,67" href="http://www.skype.com"> <area shape="rect" coords="135,1,213,77" href="http://www.apple.com"> </map> <map name="Map4"><area shape="rect" coords="497,16,647,151" href="index.html"> </map> <script language="JavaScript"> // Code for validating the form // Visit http://www.javascript-coder.com/html-form/javascript-form-validation.phtml // for details var frmvalidator = new Validator("contact_form"); //remove the following two lines if you like error message box popups frmvalidator.EnableOnPageErrorDisplaySingleBox(); frmvalidator.EnableMsgsTogether(); frmvalidator.addValidation("name","req","Please provide your name"); frmvalidator.addValidation("email","req","Please provide your email"); frmvalidator.addValidation("email","email","Please enter a valid email address"); </script> <script language='JavaScript' type='text/javascript'> function refreshCaptcha() { var img = document.images['captchaimg']; img.src = img.src.substring(0,img.src.lastIndexOf("?"))+"?rand="+Math.random()*1000; } </script> </BODY> </HTML> When someone types in thier information in my Sign Up form i want the information they entered to stay after the page refresh. For example: I type in my information, but in the email field i forget the '@' symbol and then hit "Sign Up". Then the page would refresh and i would get an error message saying "You must enter a valid email address!" and all the information i typed in before would be gone and i'd have to start over with everything.. My question is, how can i make so that all the information I entered stays after the page refresh? Is there a simple way to do it or do I have to rewrite all my code? (i've provided it below) I know that you can use jQuery, AJAX and JS to acomplish this and also show the error message without refreshing the page but I don't know much about that and i'm trying to use as little JS as I can. So if there is another easier way? Here is my PHP script that holds the validation process and shows the errors etc: <?php class Register { private $username; private $first_name; private $last_name; private $password; private $passmd5; private $email; private $confemail; private $gender; private $birth_month; private $birth_day; private $birth_year; private $iagree; private $errors; private $token; public function __construct() { $this->errors = array(); $this->username = $this->filter($_POST['username']); $this->first_name = $this->filter($_POST['first_name']); $this->last_name = $this->filter($_POST['last_name']); $this->password = $this->filter($_POST['password']); $this->email = $this->filter($_POST['email']); $this->confemail = $this->filter($_POST['confemail']); $this->gender = $this->filter($_POST['gender']); $this->birth_month = $this->filter($_POST['birth_month']); $this->birth_day = $this->filter($_POST['birth_day']); $this->birth_year = $this->filter($_POST['birth_year']); $this->iagree = $this->filter($_POST['iagree']); $this->token = $_POST['token']; $this->passmd5 = md5($this->password); } public function process() { if($this->valid_token() && $this->valid_data()) $this->register(); return count($this->errors)? 0 : 1; } public function filter($var) { return preg_replace('/[^a-zA-Z0-9@.]/','',$var); } public function register() { mysql_connect("localhost","root","") or die(mysql_error()); mysql_select_db("membership") or die (mysql_error()); $sql = "INSERT INTO users(username,password,first_name,last_name,email,gender,birth_month,birth_day,birth_year) VALUES ('{$this->username}','{$this->passmd5}','{$this->first_name}','{$this->last_name}','{$this->email}','{$this->gender}','{$this->birth_month}','{$this->birth_day}','{$this->birth_year}')"; mysql_query($sql) or die(mysql_error()); if(mysql_affected_rows()< 1) $this->errors[] = "Could Not Process Form"; } public function user_exists() { mysql_connect("localhost","root","") or die(mysql_error()); mysql_select_db("membership") or die (mysql_error()); $data = mysql_query("SELECT username FROM users WHERE username = '{$this->username}'"); return mysql_num_rows($data) > 0 ? 1 : 0; } public function show_errors() { foreach($this->errors as $key=>$value) echo "<div class=errormessages> $value </div> <br />"; } public function valid_data() { if ($this->user_exists()){ $this->errors[] = 'The username is already taken, choose another one!'; } if (empty($this->username)){ $this->errors[] = 'You must enter a username!'; } if (empty($this->first_name)){ $this->errors[] = 'You must enter your first name'; } if (empty($this->password)){ $this->errors[] = 'You must enter a password!'; } elseif (strlen($this->password) < 6){ $this->errors[] = 'Your password must be longer than 6 characters!'; } if (empty($this->email)){ $this->errors[] = 'You must enter an email address!'; } elseif (!preg_match('/^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]{2,4}$/',$this->email)){ $this->errors[] = 'You must enter a valid email address!'; } elseif ($this->email != $this->confemail){ $this->errors[] = 'The email addresses you entered did not match!'; } if (empty($this->birth_month)){ $this->errors[] = 'Select which month you were born!'; } if (empty($this->birth_day)){ $this->errors[] = 'Select which day you were born!'; } if (empty($this->birth_year)){ $this->errors[] = 'Select which year you were born!'; } if (empty($this->iagree)){ $this->errors[] = 'You must agree to the <a href="#">Privacy Policy</a> and <a href="#">Terms of Use</a> to sign up!'; } return count($this->errors)? 0 : 1; } public function valid_token() { if(!isset($_SESSION['token']) || $this->token != $_SESSION['token']) $this->errors[] = "Invalid Submission"; return count($this->errors)? 0 : 1; } } ?> And here the HTML form: Code: [Select] <?php session_start(); if(isset($_POST['register'])) { include_once('classes/class.register.php'); $register = new Register(); if($register->process()) echo "Successfully Signed Up!"; else $register->show_errors(); } $token = $_SESSION['token'] = md5(uniqid(mt_rand(),true)); ?> <!doctype html> <html> <head> <link rel="stylesheet" type="text/css" href="css/main.css"> <link rel="stylesheet" type="text/css" href="css/register.css"> <script type="text/javascript" src="js/passwordmeter.js"></script> </head> <body> <script src="jquery.js"></script> <div class="center"> <!-- PHP --> <?php require("html/menu.inc"); ?> <?php require("html/layout.inc"); ?> <?php require("html/login.inc"); ?> <!-- PHP --> <div class="register"> <header>Sign Up Now!</header> <form method="POST" action="<?php echo $_SERVER['PHP_SELF'];?>"> <ul> <li> <label for="username">* Username: </label><br /> <input name="username" autofocus="on" class="rusernamefield" type="text"></input> </li> <li> <label for="first_name">* First Name: </label><br /> <input name="first_name" class="rfirstnamefield" type="text"></input> </li> <li> <label for="last_name">Last Name: </label><br /> <input name="last_name" class="rlastnamefield" type="text"></input> </li> <li> <label for="password">* Password: </label><br /> <input name="password" class="rpasswordfield" onkeyup='password_strength(this.value)'></input> </li> <div id="password_strength_border"> <div id="password_strength" class="strength0"></div> </div> <li> <label for="email">* Email Address: </label><br /> <input name="email" class="remail" type="email" placeholder="email@address.com"></input> </li> <li> <label for="confemail">* Confirm Email Address: </label><br /> <input name="confemail" class="rconfirmemail" type="email" placeholder="email@address.com"></input> </li> <li> <label for="gender">* Gender: </label><br /> <select name="gender"> <option value="Man" selected="selected">Man</option> <option value="Woman">Woman</option> </select> </li> <li> <label for="birth_month">* Birth Day: </label><br /> <select name="birth_month"> <option disabled="disabled" selected="selected">Month</option> <option value="01">January</option> <option value="02">February</option> <option value="03">March</option> <option value="04">April</option> <option value="05">May</option> <option value="06">June</option> <option value="07">July</option> <option value="08">August</option> <option value="09">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> <select name="birth_day"> <option disabled="disabled" selected="selected">Day</option> <option value="01">1</option> <option value="02">2</option> <option value="03">3</option> <option value="04">4</option> <option value="05">5</option> <option value="06">6</option> <option value="07">7</option> <option value="08">8</option> <option value="09">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 name="birth_year"> <option disabled="disabled" selected="selected">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> </li> <li> <label for="iagree" class="iagreetext">* I Agree to the <a href="#">Privacy Policy</a> and <a href="#">Terms of Use</a></label> <input name="iagree" type="checkbox" class="iagreebox"></input> </li> <input name="register" class="registerbutton" type="submit" value="Sign Up"></input> <p class="fieldsmarked">Fields marked with an (*) is required</p> <input type="hidden" name="token" value="<?php echo $token;?>"/> </ul> </form> </div> </div> </body> </html> Hey Guys. I have a quick question. Should i "prep" input values coming from a radio or checkbox input field? Can an SQL injection occur through those 2 input fields, or is it only text fields?
I am echoing out 2 radio input fields in a foreach statement. I would like to have the first option checked in all the radio input fields that gets echoed out.
But for some reason it marks the radio input field "checked" all the way in the bottom. (The last one)
How can I make it so that every input field that gets echoed out will be marked checked?
Below is my code. Thank you for your help
foreach ($menu_cat_options as $menu_cat_option){ <input type="radio" checked="checked" name="display_type" value="radio" >Radio <br> <input type="radio" name="display_type" value="checkbox">Check Box } Hello i want make a button in one page for example button.php to refresh other page for example screen.php I have a table in a mysql database with 5 columns, id, Name, Wifi, Bluetooth, GPS, with rows that are for example 1, Galaxy S2, yes, yes, yes. So basically i want to build a form that has check boxes (3 checkboxes for wifi bluetooth and GPS respectively) that once selected will query the database depending on which check boxes are selected. I have made the form but need to know what to put in the filter.php to make the results be displayed accordingly. Ideally if anyone knows how i would want it so the results were shown on the same page which i believe u need to use ajax to happen but any help on how to show the results will be greatful. the code for the form i have made is as follows: Code: [Select] <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>test</title> </head> <body> <form action="filter.php" method="post"> <INPUT TYPE=CHECKBOX NAME="option[]" VALUE="Wifi" id="r1">Wifi <INPUT TYPE=CHECKBOX NAME="option[]" VALUE="Bluetooth" id="b1">Bluetooth <INPUT TYPE=CHECKBOX NAME="option[]" VALUE="GPS" id="g1">GPS <input type="submit" name="formSubmit" value="Submit" /> </form> </body> </html> im not sure on how to make the filter.php page but i do have this code for displaying the all the data but i want to kno how to make it only display the data from the choices on the checkboxes Code: [Select] <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>pls work</title> </head> <body> <?php function h($s) { echo htmlspecialchars($s); } mysql_connect("localhost", "root", "") or die (mysql_error()); mysql_select_db("project") or die (mysql_error()); $result= mysql_query('SELECT * FROM test') or die('Error, query failed'); ?> <?php if (mysql_num_rows($result)==0) { ?> Database is empty <br/> <?php } else { ?> <table> <tr> <th></th> <th>Name</th> <th>Wifi</th> <th>Bluetooth</th> <th>GPS</th> </tr> <?php while ($row= mysql_fetch_assoc($result)) { ?> <tr> <td> <a href="uploaded-images/<?php h($row['Name']); ?>.jpg"> <img src="uploaded-images/<?php h($row['Name']); ?>.jpg" alt="test"/> </a> </td> <td><a href="textonly.html"><?php h($row['Name']); ?></a></td> <td><?php h($row['Wifi']); ?></td> <td><?php h($row['Bluetooth']); ?></td> <td><?php h($row['GPS']); ?></td> </tr> <?php } ?> </table> <?php } ?> </body> </html> I am working on a website for my landscape architecture master's thesis centered around the Google Earth API. Through out the site I have various test questions that I pass along as hidden fields from page to page to be entered into my database at the end. My problem is: I am trying to create a button that refreshes my Google earth div container ("APEarth") without refreshing the whole page. Currently, the button refreshes the whole page creating null entries for all the previous test questions. Any help would be greatly appreciated. My code is below. Just as a side note, my skills are very limited, so specific coding help would be greatly appreciated. <?php /*?>The items below are all the AP Elements in the Design View that make up the website <?php */?> <style type="text/css"> <!-- #APBody { position:absolute; left:0px; top:0px; width:1000px; height:700px; z-index:1; margin-top: 12pt; margin-left: 12pt; } #APUpperTitleBlock { position:absolute; left:0px; top:0px; width:1000px; height:50px; z-index:2; } #APBottomTitleBlock { position:absolute; left:0px; width:1000px; height:50px; z-index:6; bottom: 0px; } #APEarth { position:absolute; top:73px; width:800px; height:577px; z-index:4; right: 0px; border-color: #000; border-width: 2 px; } #ApContinue { position:absolute; left:0px; top:51px; width:1000px; height:18px; z-index:8; text-align: right; } #APLayers { position:absolute; left:0px; top:73px; width:200px; height:576px; z-index:9; font-family: Arial, "Arial Bold", "Arial Bold Italic", "Arial Black", "Arial Italic"; font-size: 14px; font-weight: bold; } --> </style> <title>Scenario Three</title> <style type="text/css"> <!-- #APBody #APLayers p { font-weight: normal; font-family: Arial, "Arial Bold", "Arial Bold Italic", "Arial Black", "Arial Italic"; } #GoogleEarthReset { position:absolute; left:4px; top:4px; width:192px; height:13px; z-index:1; } --> </style> <script type="text/javascript"> <!-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> </script> <div id="APBody"> <div id="APUpperTitleBlock"><img src="Images/ScenarioThree_UTitleBlock.jpg" width="1000" height="50"></div> <div id="APBottomTitleBlock"><img src="Images/Website_LTitleBlock.jpg" width="1000" height="50"></div> <div id="ApContinue"> <form method="post" action="ScenarioThreeTest.php"> <?php /*?>Begin hidden pretest answers<?php */?> <input type="hidden" name="UniqueID" value="<?php echo $_POST['UniqueID']; ?>" /> <input type="hidden" name="GroupID" value="<?php echo $_POST['GroupID']; ?>" /> <input type="hidden" name="1_Age" value="<?php echo $_POST['1_Age']; ?>" /> <input type="hidden" name="2_Race" value="<?php echo $_POST['2_Race']; ?>" /> <input type="hidden" name="3_Education" value="<?php echo $_POST['3_Education']; ?>" /> <input type="hidden" name="4_Occupation" value="<?php echo $_POST['4_Occupation']; ?>" /> <input type="hidden" name="5_Income" value="<?php echo $_POST['5_Income']; ?>" /> <input type="hidden" name="6_SWM_Is" value="<?php echo $_POST['6_SWM_Is']; ?>" /> <input type="hidden" name="7_Landuse" value="<?php echo $_POST['7_Landuse']; ?>" /> <input type="hidden" name="8_Location" value="<?php echo $_POST['8_Location']; ?>" /> <input type="hidden" name="9_Participation" value="<?php echo $_POST['9_Participation']; ?>" /> <input type="hidden" name="10_Comments_Blog_Etc" value="<?php echo $_POST['10_Comments_Blog_Etc']; ?>" /> <input type="hidden" name="11_Web" value="<?php echo $_POST['11_Web']; ?>" /> <?php /*?>Begin hidden Scearnio One Test answers<?php */?> <input type="hidden" name="12_Scenario_One" value="<?php echo $_POST['12_Scenario_One']; ?>" /> <input type="hidden" name="13_Sustainable" value="<?php echo $_POST['13_Sustainable']; ?>" /> <input type="hidden" name="14_Effectiveness" value="<?php echo $_POST['14_Effectiveness']; ?>" /> <input type="hidden" name="15_Use_Techniques" value="<?php echo $_POST['15_Use_Techniques']; ?>" /> <input type="hidden" name="16_Willing_Scenario_One" value="<?php echo $_POST['16_Willing_Scenario_One']; ?>" /> <input type="hidden" name="17_Comments_Scenario_One" value="<?php echo $_POST['17_Comments_Scenario_One']; ?>" /> <?php /*?>Begin hidden Scenario Two Test answers<?php */?> <input type="hidden" name="18_Scenario_Two" value="<?php echo $_POST['18_Scenario_Two']; ?>"> <input type="hidden" name="19_Sustainable" value="<?php echo $_POST['19_Sustainable']; ?>"> <input type="hidden" name="20_Effectiveness" value="<?php echo $_POST['20_Effectiveness']; ?>"> <input type="hidden" name="21_Use_Techniques" value="<?php echo $_POST['21_Use_Techniques']; ?>"> <input type="hidden" name="22_Willing_Scenario_Two" value="<?php echo $_POST['22_Willing_Scenario_Two']; ?>"> <input type="hidden" name="23_Comments_Scenario_Two" value="<?php echo $_POST['23_Comments_Scenario_Two']; ?>"> <?php /*?>Continue to Scenario Three Button<?php */?> <input type="submit" value="Continue to Scenario Three Test" /> </form> </div> <div id="APLayers"> <form id="form1" name="form1" method="post" action=""> <p> <input type="submit" name="Refresh View" id="Refresh View" value="Refresh View" /> <br /> <br /> <a href="GEHelpVideo.html" target="_blank">Google Earth Help Video</a><a href="GEHelpVideo.html"></a></p> </form> <p><strong>Introduction: </strong></p> <p><em>Problem and/or Opportunity Identification:</em></p> <p>The Big Hollow drainage-way provides a unique opportunity for dense development. Its proximity to the urban core of State College and The Pennsylvania State University allows for continuity of development and alternative transportation. It also contains the necessary infrastructure to accomodate new development. </p> <p><em>Goal Establishment:<br /> </em><br /> 1. Expand and enhance the availability of different housing types and<br /> <br /> 2. Expand and enhance urban district growth with new commercial and industrial development.</p> </div> <div id="APEarth"></div> </div> <?php /*?>End Design View Elements<?php */?> <?php /*?>The following is the codefor Google Earth on GoDaddy.com<?php */?> <script src="http://www.google.com/jsapi?key=ABQIAAAAASFuJKi2srzH7vU9dQ775BSMepAERdnJfYrR64vZA9ytMBD-kBTzNLiWgdo_rLSrLhNdv2e5GaHvjg"> </script> <script type="text/javascript"> //Google Earth HTML var ge; google.load("earth", "1"); function init() { google.earth.createInstance('APEarth', initCB, failureCB); } function initCB(instance) { ge = instance; ge.getWindow().setVisibility(true); // add a navigation control ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO); // add an overview map ge.getOptions().setOverviewMapVisibility(true); //add the status bar ge.getOptions().setStatusBarVisibility(true); //add the scale legend ge.getOptions().setScaleLegendVisibility(true); ge.getOptions().setUnitsFeetMiles(true); // add some standsard google earth layers ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true); ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, true); //add Big Hollow Well data KML File var href1 = 'http://www.iecoplanningstudio.com/Google_Earth_Files/Scenario3Wells.kml'; google.earth.fetchKml(ge, href1, function(kmlObject) { if (kmlObject) ge.getFeatures().appendChild(kmlObject);}); //add Big Hollow existing zoning KML File var href3 = 'http://www.iecoplanningstudio.com/Google_Earth_Files/Scenario3ExLanduse.kml'; google.earth.fetchKml(ge, href3, function(kmlObject) { if (kmlObject) ge.getFeatures().appendChild(kmlObject);}); //add Big Hollow proposed zoning KML File var href4 = 'http://www.iecoplanningstudio.com/Google_Earth_Files/Scenario3PropLanduse.kml'; google.earth.fetchKml(ge, href4, function(kmlObject) { if (kmlObject) ge.getFeatures().appendChild(kmlObject);}); //add Big Hollow Video Placemark KmL File // var href5 = 'http://www.iecoplanningstudio.com/Google_Earth_Files/Landuse_Conflict_Video.kml'; // google.earth.fetchKml(ge, href5, function(kmlObject) { // if (kmlObject) // ge.getFeatures().appendChild(kmlObject);}); //add Big Hollow Existing Buildings KML File var href6 = 'http://www.iecoplanningstudio.com/Google_Earth_Files/Scenario3ExBuildings.kml'; google.earth.fetchKml(ge, href6, function(kmlObject) { if (kmlObject) ge.getFeatures().appendChild(kmlObject);}); //add Big Hollow Proposed Buildings KML File var href7 = 'http://www.iecoplanningstudio.com/Google_Earth_Files/Scenario3PropBuildings.kml'; google.earth.fetchKml(ge, href7, function(kmlObject) { if (kmlObject) ge.getFeatures().appendChild(kmlObject);}); //add Big Hollow Potential Sinkhole KML File var href8 = 'http://www.iecoplanningstudio.com/Google_Earth_Files/Potential_Sinkhole.kml'; google.earth.fetchKml(ge, href8, function(kmlObject) { if (kmlObject) ge.getFeatures().appendChild(kmlObject);}); ///-------------------------------------------------------------------------------------------------------- //Test Placemark var placemark = ge.createPlacemark(''); // Define a custom icon. var icon = ge.createIcon(''); icon.setHref('http://maps.google.com/mapfiles/kml/shapes/movies.png'); var style = ge.createStyle(''); //create a new style style.getIconStyle().setIcon(icon); //apply the icon to the style placemark.setStyleSelector(style); //apply the style to the placemark // Set the placemark's location. var point = ge.createPoint(''); point.setLatitude( 40.800827); point.setLongitude(-77.881896); placemark.setGeometry(point); // Add the placemark to Earth. ge.getFeatures().appendChild(placemark); placemark.setName('Land Use Video!'); google.earth.addEventListener(placemark, 'click', function(event) { // prevent the default balloon from popping up event.preventDefault(); var balloon = ge.createHtmlStringBalloon(''); balloon.setFeature(placemark); // optional balloon.setMaxWidth(400); // YouTube video embed... the in the beginning is a fix for IE6 balloon.setContentString( ' <object width="400" height="300"><param name="movie" ' + 'value="http://www.youtube.com/v/6mrG_bsqC6k&hl=en&fs=1"/>' + '<param name="allowFullScreen" value="true"/>' + '<embed src="http://www.youtube.com/v/oN3TNoRudfE?hl=en&fs=1" ' + 'type="application/x-shockwave-flash" allowfullscreen="true" ' + 'width="400" height="300"></embed></object>'); ge.setBalloon(balloon); }); ///-------------------------------------------------------------------------------------------------------- //Get the Current View var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND); //Set New Latitude and Longitude lookAt.setLatitude(40.794709); lookAt.setLongitude(-77.887323); lookAt.setRange(10000); // Add to the current tilt lookAt.setTilt(lookAt.getTilt() + 60); //Update View ge.getView().setAbstractView(lookAt); } function failureCB(errorCode) { } google.setOnLoadCallback(init); //End Google Earth Coding </script> |