Jump to content

Sydcomebak

Members
  • Posts

    38
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Sydcomebak's Achievements

Member

Member (2/5)

0

Reputation

  1. Fatal error: Cannot access empty property in gdform.php on line 20 Line 20 reads: foreach ($vars as $key->$val){ I think that I see where you are going with this, though... -Dave
  2. I am on a GoDaddy hosted site trying to process a form. First off, the gdform.php: <?php $request_method = $_SERVER["REQUEST_METHOD"]; if($request_method == "GET"){ $query_vars = $_GET; } elseif ($request_method == "POST"){ $query_vars = $_POST; } reset($query_vars); $t = date("U"); $file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t; $fp = fopen($file,"w"); while (list ($key, $val) = each ($query_vars)) { fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n"); fputs($fp,"$val\n"); fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n"); if ($key == "redirect") { $landing_page = $val;} } fclose($fp); if ($landing_page != ""){ header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page"); } else { header("Location: http://".$_SERVER["HTTP_HOST"]."/"); } ?> Looks to me like a recursive function that spits out all data in no particular order. My variables: "Name" - Type: Text "City" - Type: Text "Email" - Type: Text etc... Instrumentalist - Type: Checkbox - Returns "on" if checked Vocalist - Type: Checkbox - Returns "on" if checked etc... What I want is to be able to receive an email that says: Hello, you have received a response from your web form! Bob Smith of Jonesville is a - Vocalist - Instrumentalist - Harmonist ... I assume that this will be accomplished through if and echo statements like: echo $Name; echo " of "; echo $City; echo " is a<br>" if $vocalist == "on" then echo " - Vocalist<br>" ... Am I on the right track? All attempts thus far have failed. Once I get down the right path, I'm sure that I can find the rest of the way. Thanks so much, experts!
  3. Can anyone explain to me how to make global variables show up in my output? I know I need to make them "Local," but I'm at a loss on how to do that exactly... <?php session_start(); if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) { $ipnumber = " $_SERVER[REMOTE_ADDR]"; // echo $ipnumber; /* emailer engine it assumes everything is already verified befire it gets it. */ $alpha="john"; $omega="1callservice.com"; //$alpha="gweber"; //$omega="midislandwatersports.com"; //$alpha="hbrelsford"; //$omega="1callservice.com"; $mail_from = "$alpha@$omega"; //$mail_toReceipt = $xxemail; $mail_to = "$alpha@$omega"; $mail_subject = "Online Reservation by <$xxname>"; //$mail_subjectReceipt = "Jadens Welcomes you to the 360 Event"; //$headers = "From: $mail_from\n"; //$headers .= "Content-Type:text/html; charset=iso-8859-1\n"; $headers = "From: Mid Island Water Sports<$mail_from>\n"; $headers .= "Content-Transfer-Encoding: 7bit\n"; $headers .= "Content-Type:text/html; charset=iso-8859-1\n"; // get contents of a file into a string $filename = "reservationbody.php"; $fd = fopen ($filename, "r"); $mail_body = fread ($fd, filesize ($filename)); fclose ($fd); // put variable values at correct place in form // sweep through and replace all variables //foreach($HTTP_SESSION_VARS as $key => $value) { // print "\$HTTP_SESSION_VARS[".$key."] = $value \n"; // $mail_body=str_replace($key,$value,$mail_body); //} $mail_body=str_replace(xxname,$xxname,$mail_body); $mail_body=str_replace(xxaddy,$xxaddy,$mail_body); $mail_body=str_replace(xxphone,$xxphone,$mail_body); $mail_body=str_replace(xxemail,$xxemail,$mail_body); $mail_body=str_replace(xxclass,$xxclass,$mail_body); $mail_body=str_replace(xxcheckbox1,$xxcheckbox1,$mail_body); $mail_body=str_replace(xxcheckbox2,$xxcheckbox2,$mail_body); $mail_body=str_replace(xxcheckbox3,$xxcheckbox3,$mail_body); $mail_body=str_replace(xxcheckbox4,$xxcheckbox4,$mail_body); $mail_body=str_replace(xxtravel,$xxtravel,$mail_body); $mail_body=str_replace(ipnumber,$ipnumber,$mail_body); //create different top messages $mail_bodyReceipttop=' <p align="left"><font face="Tahoma, Verdana, Arial" size="2">Dear '.$xxname.',<br><br> <br><br>This is the information we received from you:<br></font>'; $mail_bodytop=' <p align="left"><font face="Tahoma, Verdana, Arial" size="2"> The following contact information has been sent from the web site. <br></font>'; $mail_body_receipt=str_replace(xxheading,$mail_bodyReceipttop,$mail_body); $mail_body=str_replace(xxheading,$mail_bodytop,$mail_body); // split mail body dsc //$mail_body_receipt=$mail_body; //create different credit card entries - only last 4 digits for receipt $four=substr($xxccnum,-4); $receiptccnum=($four." - for security only the last four digits are shown"); //echo ('<br><br><br>test is '.$ccnum.' and itest is '.$iccnum.'<br><br><br>'); //echo ('<br><br><br>receipt is '.$receiptccnum.' and itest is '.$iccnum.'<br><br><br>'); $mail_body=str_replace(xxccnumber,$xxccnum,$mail_body); $mail_body_receipt=str_replace(xxccnumber,$receiptccnum,$mail_body_receipt); //diagnostic email display //echo $mail_body; //$mail_body = "the body"; //echo "$mail_to, $mail_subject, $mail_body, $headers<br>"; $status=(mail($mail_to, $mail_subject, $mail_body, $headers)); $thanks="Thank you for your interest in Mid Island Water Sports. We sell the fun you are looking for on vacation and will contact you shortly to confirm your reservation request.<br>We will require a credit card to hold reservations. <br><br> Thank you, <br><br> The Weber Family<br> MidIslandWaterSports.com "; unset($_SESSION['security_code']); } else { // Insert your code for showing an error message here $thanks="<b>The Varification Key Has been typed incorrectly, Please go back, REFRESH and try again.</b>"; } ?> <html> <head> <title>Mid Island Watersports-Fort Myers Beach Watersports and Dolphin Tours</title> <script type="text/javascript" language="JavaScript" src="specials.js"> </script> <style type="text/css"> A.white:link,A.white:visited{color:#ffffff;text-decoration:underline;font-family:verdana,arial;font-size:10px;} A.white:hover{color:#ffffff;text-decoration:none;font-family:verdana,arial;font-size:10px;} .style3 {color: #FFFFFF; font-size: 12px; } .style6 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; } </style> </head> <body bgcolor="#003399" topmargin=0 leftmargin=0 marginheight=0 marginwidth=0> <div align="center"> <table border=0 cellpadding=0 cellspacing=0 width=650> <tr> <td align=left valign=middle colspan=2><img name="title" src="images/contact_title.jpg" width="650" height="135" border="0" usemap="#m_title" alt=""> <map name="m_title"> <area shape="rect" coords="521, 0, 650, 25" href="internetspecials.html" > </map></td> </tr> <tr bgcolor="#000000"> <td align=left valign=middle background="images/spacer.gif" width=650 height=15 bgcolor="#000000" colspan=2><font color="#ffffff" face="verdana,arial" size="1"> >> <a href="index2.html" class="white">Home</a> >> <a href="waverunners.html" class="white">Waverunners</a> >> <a href="parasailing.html" class="white">Parasailing</a> >> <a href="tours.html" class="white">Dolphin Tours</a> >> <a href="reviews.html" class="white">Read Our Reviews</a> >> </font></td> </tr> <tr> <td align=center valign=top background="images/form_back.jpg" width=650 height=410><br> <font color="#000000" size="2" face="verdana,arial"> <strong> <div align=left></div> <br> <br> <table border=0 cellpadding=0 cellspacing=0 width=600> <tr> <td align=center valign=top> </td> </tr> </table> <?php echo $thanks; ?> <table border=0 cellpadding=0 cellspacing=0 width=600> <tr> </tr> </table> <table border=0 cellpadding=0 cellspacing=0 width=600> </table> <table border=0 cellpadding=0 cellspacing=0 width=600> </table> </strong></font> </tr> <tr> <td align=center valign=middle colspan=2> </td> </tr> <tr> <td align=center valign=middle bgcolor="#336699" colspan=2><img width=650 src="images/bottom_line.gif"></td> </tr> <tr> <td bgcolor="#000099" align=right background="images/spacer.gif" height=15 width=650 colspan=2><span class="style3">Sandpiper Gulf Resort 5550 ESTERO BLVD. ~ FORT MYERS BEACH, FL 33931 ~ 239-765-0965<br> Holiday Inn Location 6890 ESTERO BLVD. ~ FORT MYERS BEACH, FL 33931 ~ 239-707-2901</span></td> </tr> </table> </div> </body> </html> I appreciate any pointers, and in no way expect someone to re-write all of that. Thanks! -Dave in Dallas
  4. I'm building an array of results instead.
  5. Hey, It displayed 3 rows, so I messed around with variables: <?php $result = mysql_query("SELECT * FROM FamilyTbl INNER JOIN PeopleTbl ON (FamilyTbl.Name_ID = PeopleTbl.NameID) WHERE FamilyTbl.House_ID = '$address' ORDER BY NameLast, NameFirst ") OR die(mysql_error()); $num_results = mysql_num_rows($result); $num_cols = 3; $num_rows_decimal = $num_results / $num_cols; $num_rows = ceil($num_rows_decimal); echo "num_results: ". $num_results. "<br>"; echo "num_cols: ". $num_cols. "<br>"; echo "num_rows: ". $num_rows. "<br><hr>"; $rows = array(); $j = 1; while($row = mysql_fetch_assoc($result)) { $data = $row['NameLast'].', '.$row['NamePrefix'].' '.$row['NameFirst'].' '.$row['NameMiddle'].$row['NameSuffix'].' '; @$rows[$j] .= ' <td>'.$data."</td>\n"; if($j == $num_rows) $j = 0; $j++; } echo "<table>\n"; foreach($rows as $row) { echo " <tr>\n" . $row . " </tr>\n"; } echo '</table>'; ?>
  6. Doesn't this just send back a boolean saying that the row has data in it?
  7. OK, let's say that I have an array of 28 names and I want to display them in columns. I want to display NameLast[1] then NameLast[4] then Namelast[7] in the first row of a table. The easiest way to do that would be to do a for loop for x = 1 to 3 do begin echo NameLast[3x-2] end I hope that's clearer.
  8. I don't want to use a where statement. I need to be able to get all results and pick them whenever I need. I know it seems weird, but I have my reasons for using this odd way. I WAY oversimplified the code to show what I need. -Dave
  9. <?php $desired_num=4; $result = mysql_query("SELECT * FROM NamesTbl") OR die(mysql_error()); WHILE ($row = mysql_fetch_array($result) ) { echo $row($desired_num)[NameLast]; } ?> How do I display the 4th ($desired_num) value in the result? -Dave
  10. I already have deleted it because I found a new command to try: ceil(). You can help me if you could show me how to display the nth result of a query assuming standard $row formatting: <?php $result = mysql_query("SELECT * FROM FamilyTbl INNER JOIN PeopleTbl ON (FamilyTbl.Name_ID = PeopleTbl.NameID) WHERE FamilyTbl.House_ID = '$address' ORDER BY NameLast, NameFirst ") OR die(mysql_error()); $num_results = mysql_num_rows($result); $num_cols = 3; $num_rows_decimal = $num_results / $num_cols; $num_rows = ceil($num_rows_decimal); echo "num_results: ". $num_results. "<br>"; echo "num_cols: ". $num_cols. "<br>"; echo "num_rows: ". $num_rows. "<br><hr>"; WHILE ($row = mysql_fetch_array($result) ) { echo $row[NameLast]. ", ". $row[NamePrefix]. " ". $row[NameFirst]. " ". $row[NameMiddle]. $row[NameSuffix]. " "; } ?>
  11. Lemmin, it printed tables one after the other but they weren't next to each other.
  12. Can you help me with what the $max = 11 is for? $i=1; $max=11; echo "<table style=\"display:inline\">"; while ($row = mysql_fetch_array($result) ) { if (!($i%$max)) echo "</table><table style=\"display:inline\">"; echo "<tr><td>" . $row['name']; $i++; } I'll play with it to see what it does, but I don't understand what tools I'm working with.
  13. <?php $result = mysql_query("SELECT * FROM FamilyTbl INNER JOIN PeopleTbl ON (FamilyTbl.Name_ID = PeopleTbl.NameID) WHERE FamilyTbl.House_ID = '$address' ORDER BY NameLast, NameFirst ") OR die(mysql_error()); WHILE ($row = mysql_fetch_array($result) ) { echo $row[NameLast]. ", ". $row[NamePrefix]. " ". $row[NameFirst]. " ". $row[NameMiddle]. $row[NameSuffix]. " "; } ?> OK, some of these queries return A LOT of names. I'd like to be able to display them in columns in a table like so: Charne, Mr. Michael Glanger, Mrs. Karin Kling, Mr. Wayne Charne, Mrs. Suzette Glanger, Mr. Trevor Lazarow, Mrs. Fiona Charney, Mrs. Linda Jochelson, Mrs. Barbara Lazarow, Mr. Mark Charney, Mr. Norman Jochelson, Mr. Neil Norton, Mr. Charles Cohen, Mr. Brendan Karlan, Mr. Dennis Norton, Mrs. Jodi Cohen, Mrs. Joanna Karlan, Mrs. Helen Roy, Mr. Michael Flekser, Mrs. Jean Kling, Mrs. Danielle Roy, Mrs. Nicki Frysh, Dr. Howard Kling, Mrs. Melanie Tsafrir, Mrs. Lauren Frysh, Mrs. Sandra Kling, Mr. Nevil Tsafrir, Mr. Thomer That way it reads top to bottom THEN left to right. math-wise, it's simple to set up: $num_results = number_of_$results; $numcols = 3; $numrows = trunc($numresults/numcols); <table> for row_loop=1 to numrows <tr> for col_loop = 1 to numcols <td> echo result(col_loop-1)*(numrows)+row_loop </td> next col_loop </tr> next row_loop </table> Anyone want to give this a shot? Revraz already directed me to http://www.phpfreaks.com/forums/index.php/topic,95426.0.html but that displayed the data from left to right then up to down like so: Charne, Mr. Michael Charne, Mrs. Suzette Charney, Mrs. Linda Charney, Mr. Norman Cohen, Mr. Brendan Cohen, Mrs. Joanna Flekser, Mrs. Jean Frysh, Dr. Howard Frysh, Mrs. Sandra Glanger, Mrs. Karin Glanger, Mr. Trevor Jochelson, Mrs. Barbara Jochelson, Mr. Neil Karlan, Mr. Dennis Karlan, Mrs. Helen Kling, Mrs. Danielle Kling, Mrs. Melanie Kling, Mr. Nevil Kling, Mr. Wayne Lazarow, Mrs. Fiona Lazarow, Mr. Mark Norton, Mr. Charles Norton, Mrs. Jodi Roy, Mr. Michael Roy, Mrs. Nicki Tsafrir, Mrs. Lauren Tsafrir, Mr. Thomer It's a good temp solution, but if anyone is good with for loops, I'd appreciate the help, thx! -Dave
  14. Revraz, this is a solution that displays in columns, but it goes left to right THEN up to down. I need to work this into an up to down THEN left to right. -Dave
×
×
  • 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.