Author Topic: What is the proper way?  (Read 19332 times)

Steve

  • This 49%er supports Romney
  • Just a Jackass
  • *
  • Posts: 16120
  • Karma: +31/-410
  • Mr. Mom
Re: What is the proper way?
« Reply #30 on: July 15, 2008, 04:21:42 PM »
like shift the headers left so they alignb with the beginning of the data
hey ethic if you and i were both courting lily allen..... oh wait, which one of us has a relationship that lasted more than the bus ride home?

Mike

  • Jackass In Charge
  • Posts: 11256
  • Karma: +168/-32
  • Ex Asshole - a better and more caring person.
Re: What is the proper way?
« Reply #31 on: July 15, 2008, 04:37:37 PM »
Code: [Select]
th
{
  text-align: left;
}

Steve

  • This 49%er supports Romney
  • Just a Jackass
  • *
  • Posts: 16120
  • Karma: +31/-410
  • Mr. Mom
Re: What is the proper way?
« Reply #32 on: July 15, 2008, 04:51:22 PM »
oh duh me. You would think after all the months spent coding myspace layouts something like this would just occur to me.
hey ethic if you and i were both courting lily allen..... oh wait, which one of us has a relationship that lasted more than the bus ride home?

Steve

  • This 49%er supports Romney
  • Just a Jackass
  • *
  • Posts: 16120
  • Karma: +31/-410
  • Mr. Mom
Re: What is the proper way?
« Reply #33 on: July 15, 2008, 04:58:58 PM »
No effect on it at all. Tried right for a test as well and no change.
hey ethic if you and i were both courting lily allen..... oh wait, which one of us has a relationship that lasted more than the bus ride home?

Steve

  • This 49%er supports Romney
  • Just a Jackass
  • *
  • Posts: 16120
  • Karma: +31/-410
  • Mr. Mom
Re: What is the proper way?
« Reply #34 on: July 16, 2008, 02:45:57 PM »
Ok i got it working.

hey ethic if you and i were both courting lily allen..... oh wait, which one of us has a relationship that lasted more than the bus ride home?

Steve

  • This 49%er supports Romney
  • Just a Jackass
  • *
  • Posts: 16120
  • Karma: +31/-410
  • Mr. Mom
Re: What is the proper way?
« Reply #35 on: July 16, 2008, 03:19:44 PM »
How can i pass information from a php file back to the referring html file? I take the input from the form, and pass it to the php file where the results are found and filtered, but then it needs to go back to the html to be printed out in the td. Would i just do it all in the html file?

Like i know i have seen php forms where they call themselves in the action but thats in a php file. IIRC i can run any php inside an html page by using <?php the code here?> like for example maybe action=" <?php call itsself here ?>"  ? I'm just not sure how to get the data results back to echoing them out in the td.

I'm also concerned that doing it all in the html file increases the discovery of directory's and table information with the view source. Not that you couldnt use VS, get the php target file, and then call it directly but it just seems "half ass"
hey ethic if you and i were both courting lily allen..... oh wait, which one of us has a relationship that lasted more than the bus ride home?

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14310
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Re: What is the proper way?
« Reply #36 on: July 16, 2008, 04:26:29 PM »
You really aren't getting the whole transfer data thing.

Set the action of the form to the same page.  Set your method to "post".  When you submit the form, the page will submit to itself and all the data will be in the $_POST array so you reference everything from $_POST['variable'].

You cannot execute php from a .html or .htm file unless the server is setup to parse those through the PHP engine.  You can combine HTML and PHP in the same page very easily.  Just jump in and out of the PHP tags.

I'm starting to get the feeling you're really not doing this right.

Steve

  • This 49%er supports Romney
  • Just a Jackass
  • *
  • Posts: 16120
  • Karma: +31/-410
  • Mr. Mom
Re: What is the proper way?
« Reply #37 on: July 16, 2008, 04:44:42 PM »
Set the action of the form to the same page.  Set your method to "post".  When you submit the form, the page will submit to itself and all the data will be in the $_POST array so you reference everything from $_POST['variable'].

Thats exactly what i was getting at. So i can do it this way, thanks
hey ethic if you and i were both courting lily allen..... oh wait, which one of us has a relationship that lasted more than the bus ride home?

Mike

  • Jackass In Charge
  • Posts: 11256
  • Karma: +168/-32
  • Ex Asshole - a better and more caring person.
Re: What is the proper way?
« Reply #38 on: July 16, 2008, 04:49:58 PM »
To go along with what ober said here is my general setup for pages:

Code: [Select]
<?php

/* Common Data */

if (isset($_REQUEST['submit']))
{
  
/* Process */
  
showresults();
  die;
}
showform();

function 
showform()
{
?>

<!-- Header stuff -->
<form action="file.php?submit" method="post">
<!-- Form Stuff -->
</form>
<!-- Footer Stuff -->
<?php
}

function 
showresults()
{
  
/* Show the results */
}

Steve

  • This 49%er supports Romney
  • Just a Jackass
  • *
  • Posts: 16120
  • Karma: +31/-410
  • Mr. Mom
Re: What is the proper way?
« Reply #39 on: July 16, 2008, 05:07:53 PM »
Thats exactly what i did. Im bad at explaining what im trying to do but you and ober hit right on what i was trying to say. I have been going back and forth by jumping in and out of php tags. I just wasnt sure if i could post to itsself the way i wanted. Now im just trying to get the results to return properly i have something out of order or typod somewhere.
hey ethic if you and i were both courting lily allen..... oh wait, which one of us has a relationship that lasted more than the bus ride home?

Steve

  • This 49%er supports Romney
  • Just a Jackass
  • *
  • Posts: 16120
  • Karma: +31/-410
  • Mr. Mom
Re: What is the proper way?
« Reply #40 on: July 17, 2008, 11:32:14 AM »
I wrote my own setup to take in a user supplied zip code, and radius, and then return the results based on that. I used a modified version of the google maps function in regards to finding results based on that input. Its flagging

Code: [Select]
while ($event = mysql_fetch_assoc($locresult))
So im thinking i did something wrong in the query. Im thinking i am wrong in the use of '>' and '<' but i have seen a few online done just like mine.

Code: [Select]
$locresult = sprintf("SELECT lat, lng FROM asa_registered_clubs WHERE lat < '$Highlat' AND Lat > '$Lowlat'
   AND lng > '$Lowlng' AND Longitude < '$Highlng'",
   mysql_real_escape_string($Highlat),
   mysql_real_escape_string($Lowlat),
   mysql_real_escape_string($$Lowlng),
   mysql_real_escape_string($Highlng));

Full code section:

Code: [Select]
<?php

$radius 
$_GET["radiusSelect"];
$zip $_GET["zip"];

$query "SELECT zip FROM asa_registered_clubs WHERE zip='$zip'";
$result mysql_query($query);

if (!
$result)
die('Error');

$lat $row['lat'];
$lng $row['lng'];

$latRange $radius / ((6076 5280) * 60);
$lngRange $radius / (((cos($lat 3.141592653589 180) * 6076.) / 5280.) * 60);

$Lowlat $lat $latRange;
$Highlat $lat $latRange;
$Lowlng $lng $lngRange;
$Highlnge $lng $lngRange;

$locresult sprintf("SELECT lat, lng FROM asa_registered_clubs WHERE lat < '$Highlat' AND Lat > '$Lowlat
   AND lng > '
$Lowlng' AND Longitude < '$Highlng'",
   mysql_real_escape_string($Highlat),
   mysql_real_escape_string($Lowlat),
   mysql_real_escape_string($$Lowlng),
   mysql_real_escape_string($Highlng)); 




if (
mysql_num_rows($result) == 0)
{
echo '<div>No events</div>';
return;
}


echo 
'
<table>
<tr>
<th>When</th>
<th>Who</th>
<th>What</th>
<th>Where</th>
</tr>'
;


while (
$event mysql_fetch_assoc($locresult))
{
echo '
<tr>
<td>'
$event['date'], ' '$event['time'], '</td>
<td class="name">
'
$event['clubgroupname'], '
<td class="event">
'
$event['event'], '
<td class="where">
'
$event['city'], 
</td>
</tr>'
;
}

echo 
'
</table>'
;

mysql_free_result($result);
mysql_free_result($locresult);
?>
hey ethic if you and i were both courting lily allen..... oh wait, which one of us has a relationship that lasted more than the bus ride home?

Perspective

  • badfish
  • Jackass In Charge
  • Posts: 4635
  • Karma: +64/-22
    • http://jeff.bagu.org
Re: What is the proper way?
« Reply #41 on: July 17, 2008, 04:29:32 PM »
>AND Longitude < '$Highlng'",

should that be lng ?

Steve

  • This 49%er supports Romney
  • Just a Jackass
  • *
  • Posts: 16120
  • Karma: +31/-410
  • Mr. Mom
Re: What is the proper way?
« Reply #42 on: July 17, 2008, 04:36:31 PM »
man this might be the ugliest code i ever wrote i got fuckups all over this bitch.

Damn warning thingy. Yea thats one of many. i have GET instead of POST too.
hey ethic if you and i were both courting lily allen..... oh wait, which one of us has a relationship that lasted more than the bus ride home?

Steve

  • This 49%er supports Romney
  • Just a Jackass
  • *
  • Posts: 16120
  • Karma: +31/-410
  • Mr. Mom
Re: What is the proper way?
« Reply #43 on: July 17, 2008, 04:47:34 PM »
Correcting the obvious errors and adding '@' to the while statement (like the google code) removed the errors but its not passing a result. Form is posting properly, im just missing something. I wanted to post updated code to show im completely retarded. Going to keep working at it till i figure it out.

Code: [Select]
<?php

$radius 
$_POST["radiusSelect"];
$zip $_POST["zip"];

$query "SELECT zip FROM asa_registered_clubs WHERE zip='$zip'";
$result mysql_query($query);

if (!
$result)
die('Error');

$lat $row['lat'];
$lng $row['lng'];

$latRange $radius / ((6076 5280) * 60);
$lngRange $radius / (((cos($lat 3.141592653589 180) * 6076.) / 5280.) * 60);

$Lowlat $lat $latRange;
$Highlat $lat $latRange;
$Lowlng $lng $lngRange;
$Highlnge $lng $lngRange;

$locresult sprintf("SELECT lat, lng FROM asa_registered_clubs WHERE lat < '$Highlat' AND Lat > '$Lowlat
   AND lng > '
$Lowlng' AND lng < '$Highlng'",
   mysql_real_escape_string($Highlat),
   mysql_real_escape_string($Lowlat),
   mysql_real_escape_string($$Lowlng),
   mysql_real_escape_string($Highlng)); 




if (
mysql_num_rows($result) == 0)
{
echo '<div>No events</div>';
return;
}


echo 
'
<table>
<tr>
<th>When</th>
<th>Who</th>
<th>What</th>
<th>Where</th>
</tr>'
;


while (
$event = @mysql_fetch_assoc($locresult))
{
echo '
<tr>
<td>'
$event['date'], ' '$event['time'], '</td>
<td class="name">
'
$event['clubgroupname'], '
<td class="event">
'
$event['event'], '
<td class="where">
'
$event['city'], 
</td>
</tr>'
;
}

echo 
'
</table>'
;

mysql_free_result($result);
//mysql_free_result($locresult);
?>
hey ethic if you and i were both courting lily allen..... oh wait, which one of us has a relationship that lasted more than the bus ride home?

Steve

  • This 49%er supports Romney
  • Just a Jackass
  • *
  • Posts: 16120
  • Karma: +31/-410
  • Mr. Mom
Re: What is the proper way?
« Reply #44 on: July 17, 2008, 04:59:33 PM »
My flow makes no sense at all. My select statement for the zip is pointless. I'm taking a radius and then trying to pull lat and lang based on a zip but that isnt going to give me a list of results within a radius. I'm just plain way off. I need to scrap all of this and start over.
hey ethic if you and i were both courting lily allen..... oh wait, which one of us has a relationship that lasted more than the bus ride home?