Jump to content

completeNewb

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

completeNewb's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. kicken, not only did you explain why my efforts failed but your solution works like a charm! endless thanks, Steve
  2. Thanks for your replies... first, auto increment is not an option, unfortunately I have two databases to juggle, one is a subset of the other (products on the website). The master database is ms sql which won't run on a unix server (the website). The master database is on an office server with a poor connection unsuited for web users to connect to. second, fetch_num_rows to get the latest id (assuming you dont delete any rows)-- but, hey, rows will get deleted. So, I need a web database that will accept updated IDs from the master database. I searched long and hard and tried numerous solutions. Sorry but the my meaningless procedure is the best I could come up with. Believe me, i would be overjoyed if anyone's got another. $sql = "SELECT * FROM prods ORDER BY IDCOL DESC limit 0,1" ; looks to me like it would select every column (?) when i only want the last ID, but I just tried it and sadly it also returns 0. This sql: SELECT IDCOL FROM prods ORDER BY IDCOL DESC LIMIT 1 works in phpMyAdmin, but once i write it as php... $newid = mysql_query('SELECT IDCOL FROM prods ORDER BY IDCOL DESC LIMIT 1'); it returns 0. I don't understand why. Steve
  3. Hi, I'm trying to get the last number from a column of numbers, add 1 to it and use this to insert a new value in the column. The column is not the primary key, indexed, or auto insert, it's just a plain old int field. $newid = mysql_query('SELECT IDCOL FROM prods ORDER BY IDCOL DESC LIMIT 1'); // the above just doesn't work--it returns 0, there are over 1200 products--I'm going nuts over this. //$newid += 1; I've commented this out, it works though (in that it adds 1 to 0) $sql = mysql_query("INSERT INTO prods (IDCOL , Prod_Code, blah... blah..) VALUES('$newid','$prod_code','blah... blah...')") or die (mysql_error()); //this works (but inserts 0 as the newID) You'd think this would be so easy. Thanks Steve
  4. If anyone else ever experiences this particular horror, the answer is to uncheck rich text formatting on the posted pdf fields. Thanks to everyone who helped me. I'm immensely grateful for your efforts. I know how to make this work now--I can dump the address array--but I'd rather not. So I do have one last question. Why isn't my if ( $addrItem = 'pharmName' ) statement working? Somehow it appears to put the wrong value (the account number) into $pharmName when, of course, I'm tryying for the input pharmacy name. Here's my page code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php echo 'This is post: <br>'; print_r( $_POST ); echo '<br>'; echo '<br>'; echo '<br>'; $address = $_POST['addr']; $orders = $_POST['prodCode']; foreach( $address as $addrItem => $addrLine ) { if ( $addrItem = 'pharmName' ) { echo 'fld name: '.$addrItem.' user typed: '.$addrLine; $pharmName = $addrLine; break; } echo '<br>'; } echo '<br>'; echo ("Pharmacy: <input class=\"inputbox\" type=\"text\" name=\"pharmName\" maxlength=\"40\" value=\"$pharmName\"><br>"); ?> <form name="form1" method="post" action=""> <input name="name" type="text" id="name" value="<?php echo $pharmName; ?>"> <form action="orderSent.php" method="post"> <input type="submit" /> </p> </form> </body> </html> And here's the source (if that helps) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> This is post: <br>Array ( [addr] => Array ( [Acc] => Acc num [contactName] => contact name [pharmName] => Pharm name [suburbName] => A suburb [wSalerName] => wsaler ) [prodCode] => Array ( [6722] => 2 [6724] => 2 ) [button6] => ) <br><br><br>fld name: pharmName user typed: Acc num<br>Pharmacy: <input class="inputbox" type="text" name="pharmName" maxlength="40" value="Acc num"><br> <form name="form1" method="post" action=""> <input name="name" type="text" id="name" value="Acc num"> <form action="orderSent.php" method="post"> <input type="submit" /> </p> </form> </body> </html> Steve
  5. Hi, looking at the above (the IE source) I'm thinking that if I turn the address fields into an array like the prodCode array I might get clean variables. Will try that after lunch. Thanks all. Steve
  6. Oops, I just looked with IE (was using firefox) seems there's a lot more on offer. Sorry, Steve <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> Array ( [Acc] => <?xml version="1.0"?><body xfa:APIVersion="Acroform:2.6.7116.0" xfa:spec="2.1" xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><p dir="ltr" style="margin-top:0pt;margin-bottom:0pt;font-family:Arial;font-size:12pt">1234</p></body> [contactName] => <?xml version="1.0"?><body xfa:APIVersion="Acroform:2.6.7116.0" xfa:spec="2.1" xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><p dir="ltr" style="margin-top:0pt;margin-bottom:0pt;font-family:Arial;font-size:12pt">me</p></body> [pharmName] => <?xml version="1.0"?><body xfa:APIVersion="Acroform:2.6.7116.0" xfa:spec="2.1" xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><p dir="ltr" style="margin-top:0pt;margin-bottom:0pt;font-family:Arial;font-size:12pt">Some pharm</p></body> [prodCode] => Array ( [6722] => 2 [6724] => 2 ) [suburbName] => <?xml version="1.0"?><body xfa:APIVersion="Acroform:2.6.7116.0" xfa:spec="2.1" xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><p dir="ltr" style="margin-top:0pt;margin-bottom:0pt;font-family:Arial;font-size:12pt">Somewhere</p></body> [wSalerName] => wholesaler [button6] => ) <?xml version="1.0"?><body xfa:APIVersion="Acroform:2.6.7116.0" xfa:spec="2.1" xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><p dir="ltr" style="margin-top:0pt;margin-bottom:0pt;font-family:Arial;font-size:12pt">Some pharm</p></body>Pharmacy: <input class="inputbox" type="text" name="pharmName" maxlength="40" value="<?xml version="1.0"?><body xfa:APIVersion="Acroform:2.6.7116.0" xfa:spec="2.1" xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><p dir="ltr" style="margin-top:0pt;margin-bottom:0pt;font-family:Arial;font-size:12pt">Some pharm</p></body>"><br> <form name="form1" method="post" action=""> <input name="name" type="text" id="name" value="<?xml version="1.0"?><body xfa:APIVersion="Acroform:2.6.7116.0" xfa:spec="2.1" xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><p dir="ltr" style="margin-top:0pt;margin-bottom:0pt;font-family:Arial;font-size:12pt">Some pharm</p></body>"> <form action="orderSent.php" method="post"> <input type="submit" /> </p> </form> </body> </html>
  7. Sorry, I don't get it. I did look at the source but it doesn't seem to have much info (all the php is server side). Here it is though. Is this what you're after? If not, please advise. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> Array ( ) <br /><br> </body> </html> The above is from the pdf with the prod array working but the bung value = fields (i.e. pdf saved with acrobat) But view source is the same for bung product array with working value= fields (i.e. pdf saved with designer)
  8. Hi, here's the whole submit page. Currently all this page does is: print_r($_Post) echo a single posted var ($pharmName) (changed from clientName) And try to fill two html fields (each time in a slightly different fashion) with the variable $pharmName. If I can get the formatting issues to work I'll be adding your code (xyph ) from the earlier question you helped me with (i.e. where prodCode => qty was matched to product descriptions). This current page is a test to see if I can fill an HTML form with all the values from a pdf catalog. There will (if this works) be several catalogs. Each will have the same address fields but different brands. Then will follow a list of ordered products and quantities. The client will be able see their pdf order as a single web page before finally submitting it. As it's a form they'll also be able to make last minute changes. [code] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php print_r( $_POST ); $pharmName= $_POST['pharmName']; echo $pharmName; echo ("Pharmacy: <input class=\"inputbox\" type=\"text\" name=\"pharmName\" maxlength=\"40\" value=\"$pharmName\"><br>"); ?> <form name="form1" method="post" action=""> <input name="name" type="text" id="name" value="<?php echo $pharmName; ?>"> <form action="orderSent.php" method="post"> <input type="submit" /> </p> </form> </body> </html> The attached pic shows the output when sent from an acrobat saved pdf. Only two products were ordered [6722] and [6724]. The problem is "<?xml version=" appears in the input box with the actual input below the box followed by these chars " /> Sending from a Adobe designer saved pdf correctly fills in the form (no extraneous chars) but the print_r($_Post) displays every field and button in the pdf and the products are in the form: [prodCode_6723_] => 7 [prodCode_6730_] => [prodCode_6731_] => Meaning the products are not in an array and all products are present whether ordered or not. So I won't be able to loop through the prodCode array and display ordered products alongside their product descriptions. (Although possibly I could find a way to do this). Steve [attachment deleted by admin]
  9. Thanks PFMaBiSmAd, Well, your suggestion sure lifted my mood for a while, and in fact it might lead to a workaround, but it didn't quite work. I've been using acrobat to edit the pdf. It seems acrobat's HTML submit feature comes with weird formatting (as described above) and there's no way to remove it with acrobat (or Foxit). If anyone knows how i can remove this extra formatting with php after the POST then please let me know (all suggestions appreciated). Acrobat won't let me change this formatting, however Adobe's life cycle designer does. Designer has format="urlencoded" as the default setting. The bummer is that designer won't pass my product code as quantity array. Rather it simply posts every field in the pdf (all mashed together, [prodCode_6747_] rather than prodCode[6747]). So at the moment it seems I can post values but lose the product array or visa versa (am still playing with this). Once again If anyone knows how i can remove the extra formatting with php after the POST then please let me know (all suggestions appreciated). Steve
  10. Sorry Pikachu2000, the 'too' is the name (!) i.e. not John but too. (I was in a hurry). And that (above) is all the code in the current submit.php which receives the post--the actual source (of the post vars) is a pdf button (in a pdf catalog) set to 'submit a form to html' this sends the post to submit.php. But I've just discovered the script above works fine by declaring: $clientName = 'John'; i.e. hard code the var instead of getting it from $_POST. So there're 'invisible' lines in the post received from the pdf, only revealed by a "value=" statement. Any ideas how to strip them from the $_POST? Steve
  11. Thanks for trying to help me here. I'm beginning to suspect it's something to do with the fact the post come from a pdf, since no one's saying "You can't use value=\"$clientName\" I'll try making a test submit html page and see if I can insert values that way (won't help with the problem though, the catalog is a pdf). Here's the offending code: I'll see if I can attach a pic of the output. (The clientName is 'too' sorry, was in a hurry & not thinking.) <body> <?php print_r( $_POST ); $clientName= $_POST['clientName']; echo $clientName; echo ("client Name: <input class=\"inputbox\" type=\"text\" name=\"clientName\" maxlength=\"40\" value=\"$clientName\"><br>"); ?> <form name="form1" method="post" action=""> <input name="name" type="text" id="name" value="<?php echo $clientName; ?>"> <form action="orderSent.php" method="post"> <input type="submit" /> </p> </form> </body> [attachment deleted by admin]
  12. Hi, assuming that it is the pdf adding the extra characters (lines): <?xml version= John Smith " /> (Which echo on its own doesn't display, but value="<?php echo $clientName; ?>" does): How might I remove them? Steve
  13. Thanks for replying Pikachu2000. The var is posted from a pdf and declared with: $clientName = $_POST['clientName']; As an earlier test I simply echoed all the posted variables & they were simply that--whatever was typed in the appropriate pdf entry field. So if John Smith is the client's name then: echo $clientName is John Smith But value="<?php echo $clientName; ?>" is: <?xml version= John Smith " /> where only the first line is in the input box. Steve
  14. Hi, I've got a pdf catalog which posts an order to a php form. The idea is that that the php page looks like an order form that the client can check before finally hitting 'submit' (i.e. along the lines of go to shopping cart). I'd like the php page to be editable. Meaning clients can not only look at their echoed order, but change it before committing to it. So the catalog order gets put into a php submit form with editable fields. I've read that others have accomplished this with statements like: value="<?php echo $clientName; ?>" Which should fill the client name input box on the order form with the posted variable. But it doesn't work properly for me, instead, the form field is filled with "<?xml version=" with the expected name on the line benath the input box and " /> on the line beneath that. Placing the input box declaration entirely within php tags doesn't work either (exactly the same output). <?php echo ("Name: <input class=\"inputbox\" type=\"text\" name=\"clientName\" maxlength=\"40\" value=\"$clientName\"><br>"); ?> Can anyone help? Steve
  15. Hi, solved it with: $products_raw = file('http://correctURL.com/prodDB.txt'); Thanks again btherl & xyph, especially xyph I'm going to use your code http://www.phpfreaks.com/forums/Smileys/nrg_alpha/cool.gif Steve
×
×
  • 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.