Jump to content

bsamson

Members
  • Posts

    150
  • Joined

  • Last visited

Everything posted by bsamson

  1. One Thing: HOLY CRAP I HAVE A LOT TO LEARN! Thanks everyone for all the help! It's finially working ... =)
  2. MJ: Your code produced something differed! Option 1: ARRAY Option 2: ARRAY LOL, so that's good. Anyway, here is the html for the options page: <div align="center"> <table border="0" width="80%" id="table3"> <tr> <td> </td> </tr> </table> <table border="0" width="550" id="table2" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#000000"> <p align="center"><b> <font face="Arial" color="#FFE100" size="2"> Please select </font></b> <font face="Arial Black" color="#FFE100" size="2"> ALL</font><b><font face="Arial" color="#FFE100" size="2"> activated features to receive credit!!</font></b></td> </tr> <tr> <td> </td> </tr> </table> <table border="0" width="480" id="table1" cellspacing="0" cellpadding="0"> <tr> <td width="173" bgcolor="#FFE100"><b><font face="Arial" size="2"> Text Messaging</font></b></td> <td width="93"> </td> <td width="161" bgcolor="#FFE100"><b><font face="Arial" size="2"> Vision</font></b></td> <td> </td> </tr> <tr> <td width="173"><b><font face="Arial" size="2">None</font></b></td> <td width="93"><input type="radio" value="" name="op1" checked></td> <td width="161"><b><font face="Arial" size="2">None</font></b></td> <td> <input type="radio" value="" name="op2" checked></td> </tr> <tr> <td width="173"><font face="Arial" size="2">$5.00</font></td> <td width="93"><input type="radio" value="TEXT-$5" name="op1"></td> <td width="161"><font face="Arial" size="2">$15.00</font></td> <td> <input type="radio" value="Vision-$15" name="op2"></td> </tr> <tr> <td width="173"><font face="Arial" size="2">$10.00</font></td> <td width="93"><input type="radio" value="TEXT-$10" name="op1"></td> <td width="161"><font face="Arial" size="2">$20.00</font></td> <td> <input type="radio" value="Vision-$20" name="op2"></td> </tr> <tr> <td width="173"><font face="Arial" size="2">$15.00</font></td> <td width="93"> <input type="radio" value="TEXT-$15" name="op1"></td> <td width="161"><font face="Arial" size="2">$25.00</font></td> <td> <input type="radio" value="Vision-$25" name="op2"></td> </tr> <tr> <td width="173"><font face="Arial" size="2">$20.00</font></td> <td width="93"> <input type="radio" value="TEXT-$20" name="op1"></td> <td width="161"><font face="Arial" size="2">$30.00</font></td> <td> <input type="radio" value="Vision-$30" name="op2"></td> </tr> <tr> <td width="173"> </td> <td width="93"> </td> <td width="161"> </td> <td> </td> </tr> <tr> <td width="173" bgcolor="#FFE100"><b><font face="Arial" size="2"> Protection</font></b></td> <td width="93"> </td> <td width="161" bgcolor="#FFE100"><b><font face="Arial" size="2">GPS Services</font></b></td> <td> </td> </tr> <tr> <td width="173"><font face="Arial" size="2">TEP Insurance ($7)</font></td> <td width="93"><input type="checkbox" name="op3" value="TEP-$7"></td> <td width="161"><b><font face="Arial" size="2">None</font></b></td> <td><input type="radio" value="" name="op5" checked></td> </tr> <tr> <td width="173"><font face="Arial" size="2">Roadside Assistance ($4)</font></td> <td width="93"> <input type="checkbox" name="op4" value="RoadsideAssistance-$4"></td> <td width="161"><font face="Arial" size="2">Sprint Navigation ($9.99)</font></td> <td> <input type="radio" value="Sprint_Navigation-$9.99" name="op5"></td> </tr> <tr> <td width="173"> </td> <td width="93"> </td> <td width="161"><font face="Arial" size="2">Family Locator ($9.99)</font></td> <td><input type="radio" value="Family_Locator-$9.99" name="op5"></td> </tr> <tr> <td width="173"> </td> <td width="93"> </td> <td width="161"> </td> <td> </td> </tr> <tr> <td width="173" bgcolor="#FFE100"><b><font face="Arial" size="2"> Phone As Modem Plans</font></b></td> <td width="93"> </td> <td width="161" bgcolor="#FFE100"><b><font face="Arial" size="2"> Blackberry Data Plans</font></b></td> <td> </td> </tr> <tr> <td width="173"><b><font face="Arial" size="2">None</font></b></td> <td width="93"><input type="radio" value="" name="op6" checked></td> <td width="161"><b><font face="Arial" size="2">None</font></b></td> <td><input type="radio" value="" name="op7" checked></td> </tr> <tr> <td width="173"><font face="Arial" size="2">40MB Plan ($39.99)</font></td> <td width="93"> <input type="radio" value="PAM_40MB-$39.99" name="op6"></td> <td width="161"><font face="Arial" size="2">10MB Data ($39.99)</font></td> <td> <input type="radio" value="Blackberry_10MB-$39.99" name="op7"></td> </tr> <tr> <td width="173"><font face="Arial" size="2">Unlimited Plan ($39.99)</font></td> <td width="93"> <input type="radio" value="PAM_Unlimited-$39.99" name="op6"></td> <td width="161"><font face="Arial" size="2">Unlimited Data ($39.99)</font></td> <td> <input type="radio" value="Blackberry_Unlimited-$39.99" name="op7"></td> </tr> <tr> <td width="173"> </td> <td width="93"> </td> <td width="161"> </td> <td> </td> </tr> <tr> <td width="173" bgcolor="#FFE100"><b><font face="Arial" size="2"> Miscellaneous Addons</font></b></td> <td width="93"> </td> <td width="161"> </td> <td> </td> </tr> <tr> <td width="173"><font face="Arial" size="2">Mobile to Mobile ($5)</font></td> <td width="93"> <input type="checkbox" name="op8" value="Mobile2Mobile-$5"></td> <td width="161"> </td> <td> </td> </tr> <tr> <td width="173"><font face="Arial" size="2">Sprint to Home ($5)</font></td> <td width="93"> <input type="checkbox" name="op9" value="Sprint2Home-$5"></td> <td width="161"> </td> <td> </td> </tr> <tr> <td width="173"><font color="#FFFFFF" face="Arial" size="2">-- </font></td> <td width="93"> </td> <td width="161"> </td> <td> </td> </tr> </table> </div> Please ignore to code not being pretty ... This table was produced using frontpage. Generally I go back into code view and make it 'pretty'. Anyway, thanks for any assistance!
  3. Changed it, and still same problem. Code: // Load Options $optcount = 0; for ($i=0;$i<=14;$i++) { $x = "op" . $i; if ((!empty($_POST[$x])) && ($_POST[$x] != NULL)) { $opt[] = array($_POST[$x]); $optcount++; } } Code @ bottom (w/ options): <? for ($zz=1;$zz<=$optcount;$zz++) { echo " <tr> <td width='135'><b><font face='Arial' size='2'>Option ".$zz.":</font></b></td> <td><font face='Arial' size='2'>".$opt[$zz]."</font></td> </tr>"; } ?> I cannot figure out why it says array instead of the option!. As always seems to be the case w/ PHP ... it's something small & stupid I'm missing.
  4. At the top of the page ... // Load Options $optcount = 0; for ($i=1;$i<=15;$i++) { $x = "op" . $i; if ((!empty($_POST[$x])) && ($_POST[$x] != NULL)) { $opt[] = array($_POST[$x]); $optcount++; } }
  5. Didn't make any difference. Still displays ARRAY for option 1, and nothing for option 2. This is weird! Any other suggestions? I am sorry just learning arrays. In fact, I think I should have learned about them long before now because they would have made my life a LOT easier! Anyway, thanks in advance for the direction! Best Regards
  6. <tr> <td width="135"><b><font face="Arial" size="2">Option Count:</font></b></td> <td><? echo $optcount; ?></td> </tr> <tr> <td width="135"> </td> <td> </td> </tr> <? for ($zz=1;$zz<=$optcount;$zz++) { echo " <tr> <td width='135'><b><font face='Arial' size='2'>Option $zz:</font></b></td> <td><font face='Arial' size='2'>$opt[$zz]</font></td> </tr>"; } ?>
  7. hhhmmm ... no parse error. When I tried this: LINE 187: <td><font face='Arial' size='2'>$opt['$zz']</font></td> I get this error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/nnyserve/public_html/internal/ebd/addentry.php on line 187 W/O the double quotes I get: Option Count: 2 Option 1: Array Option 2: Am I missing something?
  8. Thanks for all your help! Just one more thing. I used this code: // Load Options $optcount = 0; for ($i=1;$i<=15;$i++) { $x = "op" . $i; if ((!empty($_POST[$x])) && ($_POST[$x] != NULL)) { $opt[] = array($_POST[$x]); $optcount++; } } With no errors. Now I have this code: <tr> <td width="135"><b><font face="Arial" size="2">Option Count</font></b></td> <td><? echo $optcount; ?></td> </tr> <tr> <td width="135"> </td> <td> </td> </tr> <? for ($zz=1;$zz<=$optcount;$zz++) { echo " <tr> <td width='135'><b><font face='Arial' size='2'>Option $zz:</font></b></td> <td><font face='Arial' size='2'>$opt[$zz]</font></td> </tr>"; } ?> Which displays: Option Count: 2 Option 1: Array Option 2: Any Suggestions why it displays 'Array' for option one, and nothing for option 2? Thanks in advance! Best Regards, Brian
  9. Thanks! Yes, I understand how HTML treats the radio buttons. That's why I grouped all features. By the way, I have 15 DIFFERENT radio groups w/ different options. For Example: TEST MESSAGING (op1) value = "NULL" (SELECTED) value = "$5 pack" value = "$7 pacl" Insurance (op2) value = "YES" value = "No" ect ... ect ... As far as the code's concerned, I tried that code with one correction. Here is the code: Line 27: // Load Options Line 28: for ($i=1;$i<=15;$i++){ Line 29: $x = "op" . $i; Line 30: if ((!empty($_POST[$x]) && ($_POST[$x] != "null")) { Line 31: $opt[] = array($_POST[$x]); Line 32: } } And now I am getting this error: Parse error: syntax error, unexpected '{' in /home/nnyserve/public_html/internal/ebd/addentry.php on line 30 I know it's gotta be something small I am missing! I have been at this for over 2 hours, so please excuse my frustration. Thanks! Best Regards, Brian
  10. Good Morning. I have been reading and racking my brain on how to best do this. Please any comments/suggestions ARE VERY MUCH APPRECIATED! Alright, on page 1 the end user selects has upto 15 options all of which are hard coded like: <input type="radio" value="TEXT-$5" name="op1"> And obviously the op(#) are hard coded. Once the user hits submit on the next page I want to build an array that will check for "null" or empty op(#) fields and only fill it w/ the fields that contain actual info. This is what I have ... // Load Options for ($i=1;$i<=15;$i++){ if ((!empty($_POST[op$i]) && ($_POST[op$i} != "null")) { $opt[] = array($_POST[$op$i]); } } And I get this error each time: Parse error: syntax error, unexpected T_VARIABLE, expecting ']' in /home/nnyserve/public_html/internal/ebd/addentry.php on line 29 Please remember this is my 1st time of working w/ arrays . I know that I am forgetting something, and again any assistance would be GREATLY appreciated! Best Regards, Brian
  11. Hello, I am trying to take a image file and resize it based on # of total pixels. When I run the script it does NOTHING to the pic ... it just maintains it's original size. Any assistance would be greatly appreciated! CODE: <? function imageResize($width, $height, $target) { // takes the larger size of the width and height and applies the // formula accordingly...this is so this script will work // dynamically with any size image if ($width > $height) { $percentage = ($target / $width); } else { $percentage = ($target / $height); } //gets the new value and applies the percentage, then rounds the value $width = round($width * $percentage); $height = round($height * $percentage); // returns the new sizes in html image tag format...this is so you // can plug this function inside an image tag and just get the return "width=\"$width\" height=\"$height\""; } $mysock = getimagesize("members/girl.jpg"); ?> <!-using a standard html image tag, where you would have the width and height, insert your new imageResize() function with the correct attributes --> <img src="members/girl.jpg" <? imageResize($mysock[0], $mysock[1], 500); ?>>
  12. THANKS! You know, I knew it was going to be something simple ... eeerrr. Thanks for the advice!
  13. I have a table within the database, nnyserve_main. The table is called: ebdopt. I have 3 fields, id, cat, and option. I keep getting the following syntax error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'option) VALUES ('', 'Data Services', '453')' at line 1 Here's the script: <? $cat = "Data Services"; $option="453"; // connection information $hostName = "localhost"; $userName = "nnyserve_main"; $password = "MYPASSWORDHERE"; $dbName = "$dbname"; // make connection to database mysql_connect($hostName, $userName, $password) or die("Unable to connect to host $hostName"); mysql_select_db($dbName) or die( "Unable to select database $dbName"); mysql_query("INSERT INTO ebdopt(id, cat, option) VALUES ('', '$cat', '$feature')") or die (mysql_error()); ?> I am running MySQL version: 5.0.37 w/ php 5. For the life of my I cannot find the error! Any assistance would be greatly appreciated!
  14. OOPS ... 3 hours of trying to figure this out ... and as usual ... something silly ... header('Location: http://1234.domain.com/login.php'); not header('http://1234.domain.com/login.php'); Thanks for your help!
  15. hmmm ... when I added that code ... it displayed HEADER TEST. Any ideas why what I had didn't work? <?php default: header('http://www.mydomain.com/login.php'); break; ?>
  16. Hello, I have a script that I have wrote ... that I cannot seem to be able to figure out ... here it is ... This code works if the IP address is a match, BUT if it is not a match why does this code not use the DEFAULT switch?? Please, any assistance would be greatly appreciated! $ip = $REMOTE_ADDR; switch ($ip) { case '***********': setcookie("nym_loc", "Great Northern", time()+3600); setcookie("nym_fst", "NCB11620-4", time()+3600); setcookie("nym_pre", "42871", time()+3600); break; case '*********': setcookie("nym_loc", "Shoppingtown", time()+3600); setcookie("nym_fst", "NCB11620-6", time()+3600); setcookie("nym_pre", "42872", time()+3600); break; case '**********': setcookie("nym_loc", "Liverpool", time()+3600); setcookie("nym_fst", "NCB11620-1", time()+3600); setcookie("nym_pre", "42639", time()+3600); break; case '*********': setcookie("nym_loc", "Camillus", time()+3600); setcookie("nym_fst", "NCB11620-8", time()+3600); setcookie("nym_pre", "42876", time()+3600); break; case '**********': setcookie("nym_loc", "Colonie", time()+3600); setcookie("nym_fst", "NCB11620-7", time()+3600); setcookie("nym_pre", "42874", time()+3600); break; case '************': setcookie("nym_loc", "Vestal", time()+3600); setcookie("nym_fst", "NCB11620-2", time()+3600); setcookie("nym_pre", "vestalpc", time()+3600); break; case '*********': setcookie("nym_loc", "New Hartford", time()+3600); setcookie("nym_fst", "NCB11620-10", time()+3600); setcookie("nym_pre", "51885", time()+3600); break; case '**********': setcookie("nym_loc", "Canadaigua", time()+3600); setcookie("nym_fst", "NCB11620-12", time()+3600); setcookie("nym_pre", "canpc", time()+3600); break; case '***********': setcookie("nym_loc", "Cortland", time()+3600); setcookie("nym_fst", "NCB11620-14", time()+3600); setcookie("nym_pre", "cortlandpc", time()+3600); break; case '***********': setcookie("nym_loc", "Watertown", time()+3600); setcookie("nym_fst", "NCB11620-11", time()+3600); setcookie("nym_pre", "51886", time()+3600); break; case '**********': setcookie("nym_loc", "Guest", time()+3600); setcookie("nym_fst", "_____________________", time()+3600); setcookie("nym_pre", "_____________________", time()+3600); break; default: header('http://www.mydomain.com/login.php'); break; }
  17. Alright. I have a form on let's say, page 1 and the form contains a dropdown with numbers as values. IE: <select size="1" name="store"> <option value="1">Auburn</option> <option value="2">Camillus</option> <option value="3">Canandaigua</option> <option value="4">Colonie</option> <option value="5">Cortland</option> <option value="6">Great Northern</option> <option value="7">Liverpool</option> <option value="8">New Hartford</option> <option value="10">Oneonta</option> <option value="12">Shoppingtown</option> <option value="13">Vestal</option> <option value="14">Watertown</option> </select> Now, the form get's directed to page 2 and I have this code: switch ($_POST[store]) { case 1: $stadr = "1234 duffy ave"; $cszip = "New York, NY"; $phnum = "111-222-3333"; case 2: $stadr = "1234 duffy ave"; $cszip = "New York, NY"; $phnum = "111-222-3333"; case 3: $stadr = "1234 duffy ave"; $cszip = "New York, NY"; $phnum = "111-222-3333"; case 5: $stadr = "1234 duffy ave"; $cszip = "New York, NY"; $phnum = "111-222-3333"; case 6: $stadr = "1234 duffy ave"; $cszip = "New York, NY"; $phnum = "111-222-3333"; case 7: $stadr = "1234 duffy ave"; $cszip = "New York, NY"; $phnum = "111-222-3333"; case 8: $stadr = "1234 duffy ave"; $cszip = "New York, NY"; $phnum = "111-222-3333"; case 10: $stadr = "1234 duffy ave"; $cszip = "New York, NY"; $phnum = "111-222-3333"; case 12: $stadr = "1234 duffy ave"; $cszip = "New York, NY"; $phnum = "111-222-3333"; case 13: $stadr = "1234 duffy ave"; $cszip = "New York, NY"; $phnum = "111-222-3333"; case 14: $stadr = "1234 duffy ave"; $cszip = "New York, NY"; $phnum = "111-222-3333"; } PLEASE NOTE that each case has a different address I just changed it for the sake of posting it here. Now, when I run through page 1 and hit submit it always displays case 14's variables. So, I went and I put an echo statement at the top (ie: echo $_POST[store]; ) and it returns the proper values. I just cannot figure out why It' not working. Please, any advice would be very much appreciated! Thanks.
  18. Hmmm ... wonder what was wrong w/ mine. Anyway, as usual, works PERFECT orio! Cant thank you enough!
  19. I cant figure this out ... it still isn't working ... any other suggestions ...
  20. Orio,   alright new script looks like this: [code]<?php $fn = $_GET[f].".pdf"; $fullname = "http://internal.mydomain.com/docs/$fn"; if(ini_get('zlib.output_compression')) //Required for IE   ini_set('zlib.output_compression', 'Off'); header("Pragma: public"); //Some browsers require this header("Cache-Control: private",false); //Some browsers require this header("Content-Transfer-Encoding: binary"); header("Content-Length: " . filesize($fullname)); header('Content-Type: application/pdf'); header("Content-Disposition: attachment; filename=" . $fullname); readfile($fullname); // echo $filename; ?>[/code]   And still IE tried download the php file, fd-pdf.php. Any suggestions? Could it be this line: header("Content-Disposition: attachment; filename=" . $fullname); ? Thanks!
  21.   Alight. I have a 'forced download' script that I have made my own ... Here's how it works ... I have all my .pdf files located in the docs directory. So ...  I have links on the Documents page that look like this: http://internal.mydomain.com/scripts/fd-pdf.php?f=3. The 3 is the name of the file. All of the documents in the 'docs' directory are pdf files. So I have the following script: fd-pdf.php [code]<?php $fn = $_GET[f].".pdf"; $fullname = "http://internal.mydomain.com/docs/$fn"; header("Content-Length: " . filesize($fullname)); header('Content-Type: application/pdf'); header("Content-Disposition: attachment; filename=".$fullname); readfile($fullname); // echo $fullname; ?>[/code]   I have echoed the $fullname and I know that it is correct. BUT when I click the link IE tries to download fd-pdf. Can I please get some guidance. Thanks!
  22. I have a form w/ 7 mandatory fields: First Name, Last Name, City, Zip Code, Username, Password, and lastly Alias What is the most efficient way to check for values of all those fields and redirect back if any are found to be empty ... The following is the way I have been doing this: [code]<?php if (empty($fname))  {   header( ...   } elseif {   (empty($fname))  {   header( ...  //  ETC ... ETC ... ?>[/code] Any suggestions?? ... Thanks!
  23. I found a php script that forces a file to be downloaded opposed to being opened in the browser. Here is the script: [code]<?php $f = $_REQUEST['f']; $pth = "http://1234.domain.com/docs/"; if ($f==1) {     $file = "training101.pdf";     }     $filename = $pth . $file; // required for IE, otherwise Content-disposition is ignored if(ini_get('zlib.output_compression'))   ini_set('zlib.output_compression', 'Off'); // addition by Jorg Weske $file_extension = strtolower(substr(strrchr($filename,"."),1)); if( $filename == "" ) {   echo "<html><title>MY DOMAIN - Error</title><body>ERROR: download file NOT SPECIFIED. USE force-download.php?file=filepath</body></html>";   exit; } elseif ( ! file_exists( $filename ) ) {   echo "<html><title>MY DOMAIN - Error</title><body>ERROR: File not found. USE force-download.php?file=filepath</body></html>";   exit; }; switch( $file_extension ) {   case "pdf": $ctype="application/pdf"; break;   case "exe": $ctype="application/octet-stream"; break;   case "zip": $ctype="application/zip"; break;   case "doc": $ctype="application/msword"; break;   case "xls": $ctype="application/vnd.ms-excel"; break;   case "ppt": $ctype="application/vnd.ms-powerpoint"; break;   case "gif": $ctype="image/gif"; break;   case "png": $ctype="image/png"; break;   case "jpeg":   case "jpg": $ctype="image/jpg"; break;   default: $ctype="application/force-download"; } header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); // required for certain browsers header("Content-Type: $ctype"); // change, added quotes to allow spaces in filenames, by Rajkumar Singh header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" ); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($filename)); readfile("$filename"); exit(); ?>[/code] When I run this script I get this error: [i]ERROR: File not found. USE force-download.php?file=filepath[/i] So I wanted to make sure the 'f' was passing correctly so I have this code: [code]<?php $f = $_REQUEST['f']; $pth = "http://1234.domain.com/docs/"; if ($f==1) {     $file = "training101.pdf";     }     $filename = $pth . $file; echo $filename; ?>[/code] Then the above script is ran w/ http://1234.mydomain.com/force-download.php?f=1 This is what i get: [i]http://1234.mydomain.com/docs/training101.pdf[/i] Any Suggestions? Thanks in advance!
  24. Hello. After testing the script ... I think it is corrupting my pdf files ... Here's my code: [code]<?php // would reference script with: http://internal.mydomain.com/scripts/force.php?f=doc.pdf $pth = "http://internal.mydomain.com/docs/"; $f = $_REQUEST['f']; $file = $pth . $f; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header('Accept-Ranges: bytes'); header('Content-Length: ' . filesize($file)); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=".basename($file)); header("Content-Description: File Transfer"); @readfile($file); ?>[/code]   When I attempt to open once downloaded I get this error in adobe: [i]  Adobe Reader could not open 'doc.pdf' because either it is not a supported file type or because the file has been damaged (for example, it was sent as an email attachement and wasn't correctly decoded.)[/i]   But When i download directly it works fine ... any suggestions? Thanks!
  25. Thank you ... I was obviously searching for the wrong thing ... should've been 'force download'. Thanks!
×
×
  • 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.