Jump to content

tsiedsma

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tsiedsma's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Here is a snippet from one of my forms: [code]         <tr>           <td class="form">Relationship:</td>           <td class="form"><select name="status">               <option value="FA">Family               <option value="FR">Friend               <option value="BU">Employer               <option value="OT">Other             </select></td>           <td class="form">Please select one option </td>         </tr> [/code] When that form submits, the form processor has this code to interpret the form data that was submitted: [code] $status = $_POST['status']; if (!$status) { echo '<center><h1>You did not submit the following required information!</h1></center><br />';     if(!$status){         echo "Relationship is a required field. Please enter it below.<br />";     } [/code] I have an email function setup as well, setup my headers: [code] $headers  = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\n"; $headers .= "From: $sender\n"; [/code] And then I add my data to an array first. [code] $send = array (     'status'    => $status,     ); [/code] And then I setup the body of the mail message: [code] $body  = "Status: ".$send['status']; [/code] And then I send the message: [code] mail ("yourname@yourdomain.com" , $subject, $body, $headers); [/code]
  2. What exactly are you trying to do? Add a drop down list to your form and have the option selected emailed in your form? What did you try that didn't work?
  3. I have some data in a database I want to display in 2 columns. How can I accomplish this? [code] <? include 'dbax.php'; $result = mysql_query("SELECT * FROM locations ORDER BY name ASC"); $myrow = mysql_fetch_array($result); if (!$result) {    die('Could not view record:' . mysql_error());   }    if ($myrow = mysql_fetch_array($result)) { $itemsPerRow = 2; $count = 0; while($row = mysql_fetch_array($result)) {   if ($count % $itemsPerRow == 0)   $count++; //echo <td> tags and array $row[whatever] data  here. } echo "</table>"; } else {     echo "<p><strong>There is currently no information in the database.</strong></p><br>";     } mysql_free_result($result); mysql_close(); ?> [/code] I have 9 rows I need displayed for each group. I want the groups of data to be 2 across and 2 or 3 rows down. I would also like to add a next link or button to view the next group of data. Here is a quick example of what I am wanting it to look like: [a href=\"http://img163.imageshack.us/my.php?image=image1tm.gif\" target=\"_blank\"][img src=\"http://img163.imageshack.us/img163/1310/image1tm.th.gif\" border=\"0\" alt=\"IPB Image\" /][/a]
  4. I need a little help. I need to add some code to a form processor. I will be passing these variables: [code] $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; [/code] to this: [code] $url = "http://api.local.yahoo.com/MapsService/V1/geocode?appid=crappyfiles&street=".$address."&city=".$city."&state=".$state."&zip=".$zip.""; [/code] I then need to parse that XML and pull 3 values from the results which looks like this: [code] <ResultSet xsi:schemaLocation="urn:yahoo:maps http://api.local.yahoo.com/MapsService/V1/GeocodeResponse.xsd"> - <Result precision="address">    <Latitude>41.77769</Latitude>    <Longitude>-93.729599</Longitude>    <Address>237 N CHEROKEE DR</Address>    <City>POLK CITY</City>    <State>IA</State>    <Zip>50226-1182</Zip>    <Country>US</Country> </Result> </ResultSet> [/code] I need to pull the longitude, latitude and zip code from that generated xml and have it be the following variables: [code] $lng = longitude $lat = latitude $zip = zip [/code] I am a total noob and need help doing this. I know its not that hard for some of you, so if you have a little time I would really appreciate it.
  5. I don't have one. I got that snippet of code from [a href=\"http://www.mapki.com/index.php?title=Batch_Geocode_Addresses\" target=\"_blank\"]http://www.mapki.com/index.php?title=Batch_Geocode_Addresses[/a]. I am just trying to make it work on my site. What do I need to do?
  6. This code will take in three variables ($address, $city, $state) and find the longitude, latitude and zip code. This uses the Yahoo! API geocoding service. Here is the snippit of code I acquired from [a href=\"http://www.mapki.com/index.php?title=Batch_Geocode_Addresses\" target=\"_blank\"]MAPKI[/a] [code] $url = "http://api.local.yahoo.com/MapsService/V1/geocode?appid=xxxxxxxxxxx&street=".$address."&city=".$city."&state=".$state.""; $myFile = new XMLParser($url); $xmlRoot = $myFile->data[0];   if (sizeof($xmlRoot) > 0 ) {         $geoLocation = $xmlRoot['child'];         if (sizeof($geoLocation) > 0) {                 $geoLocationProperties = $geoLocation[0]['child'];                 for ($i = 0; $i < sizeof($geoLocationProperties); $i++) {                         //echo $geoLocationProperties[$i]['name'] . " = " . $geoLocationProperties[$i]['content']."<br/>";                     $map_data[strtolower($geoLocationProperties[$i]['name'])] = $geoLocationProperties[$i]['content'];                 }         } } $long = $map_data['longitude']; $lat = $map_data['latitude']; $zip = $map_data['zip']; [/code] I acquired my own appid and embedded the code in my page. I have a form that passes variables to this page. 3 of which are $address, $city and $state. When I submit my form, I get the following error: [b]Fatal error[/b]: Cannot instantiate non-existent class: xmlparser in [b]/home2/tsiedsma/public_html/crappyfiles/map2/update.php[/b] on line [b]20[/b] Line 20: [code] $myFile = new XMLParser($url); [/code] Here is the code up to and including the yahoo api code I included. [code] <? include 'dbax.php'; # grab the POST variables from the HTML form, # put them into PHP variables so we can work with them $name = $_POST['name']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $phone = $_POST['phone']; $email = $_POST['email']; $ur = $_POST['ur']; $status = $_POST['status']; $ip = $_SERVER['REMOTE_ADDR']; $approved = $_POST['approved']; $url = "http://api.local.yahoo.com/MapsService/V1/geocode?appid=crappyfiles&street=".$address."&city=".$city."&state=".$state.""; $myFile = new XMLParser($url); $xmlRoot = $myFile->data[0];   if (sizeof($xmlRoot) > 0 ) {         $geoLocation = $xmlRoot['child'];         if (sizeof($geoLocation) > 0) {                 $geoLocationProperties = $geoLocation[0]['child'];                 for ($i = 0; $i < sizeof($geoLocationProperties); $i++) {                         //echo $geoLocationProperties[$i]['name'] . " = " . $geoLocationProperties[$i]['content']."<br/>";                     $map_data[strtolower($geoLocationProperties[$i]['name'])] = $geoLocationProperties[$i]['content'];                 }         } } $lng = $map_data['longitude']; $lat = $map_data['latitude']; $zip = $map_data['zip']; [/code] I don't understand what the error means or what I need to do to fix it. Help me please.
  7. Nevermind, I am a genius and figured it out. I was missing a comma somewhere.
  8. OK, I fixed the selection issue. I used the following code and now it selects the appropriate checkbox based on the mysql field value. [code]           <td colspan="2"><input type="radio" name="ud_approved" value="YES"           <?php             if ( $approved == 'YES' ) {                 echo 'checked=\"checked\" ';             }             ?>>YES             <input type="radio" name="ud_approved" value="NO"             <?php               if  ( $approved == 'NO' ) {                 echo 'checked=\"checked\" ';               }             ?>>NO            </td> [/code] Next issue... If I click on the opposite radio button and click submit to update my changes, it does not update the mysql table. Do I need to tree radio buttons differently for submitting form data to mysql?
  9. I found a piece of code that will check a radio button based on form input but I am pulling data from a database and prefilling the form data so I can update the data stored in the database. [code]           <td colspan="2"><input type="radio" name="ud_approved" value="YES"           <?php             if (isset($_POST['ud_approved']) && $_POST['ud_approved'] == 'YES') {                 echo 'checked=\"checked\" ';             }             ?>>YES             <input type="radio" name="ud_approved" value="NO"             <?php               if (isset($_POST['ud_approved']) && $_POST['ud_approved'] == 'NO') {                 echo 'checked=\"checked\" ';               }             ?>>NO        </td> [/code] I want the radio button to be preselected based on whether or not the field 'approved' in the database says either "YES" or "NO". How can I do this with simple php? The other issue is, I need to update the database with my selection on the radio buttons. If I choose YES or NO, I need it to update to mysql. Do I have to do anything special to make this work? Just so you know, I am able to update every field except the radio buttons. They do not work for updating.
×
×
  • 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.