Jump to content

tjohnson_nb

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tjohnson_nb's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have an application that creates quotations, orders etc. and as the user adds items the page reloads and can quite long. The problem is then the user has to scroll down to the last item to add another one - this gets to be quite time-consuming. Is there a way I can get it to do this automatically? I have tried putting anchors on each line item like this; echo "<form action='display_quotation.php?item=$detail_number' method='post'>\n"; ......... echo "<a name='item_$detail_number'></a>\n"; and put the javascript ; <script type='text/javascript'> function goToAnchor() { window.location.hash='#item_$item'; } </script> </head> <body onload='goToAnchor();' > This doesn't seem to work - I get in the URL http://my_domain/display_quotation.php?item=3#item_3 but the page always goes to tiem no matter what item is passed via post.
  2. Yes that works so I guess I don't need to use the image. The really strange thing is I have the exact same code running in another file (actually several) with that image and they all work! Mystery
  3. Not sure if anyone can help here - this involves javascript and php. I have a simple javascript like this; function disp_confirm(companyid) { var link='companies.php?action=Archive&companyid='+companyid; var c=confirm('Do you really want to archive this company?'); if (c==true) { document.location.href=link; } } And further in the php code I have; echo " <input type=\"image\" src=\"../b_drop.png\" onclick=\"disp_confirm('$companyid')\">\n"; When you click on the image (b_drop.png) the confirmation box comes up but when you click 'ok' the _GET variables in the javascript link are not passed to the server but for some reason the coordinates of where you clicked the image are?? I get this output from the $_POST variable but nothing from the $_GET variable and I'm not posting anything. companyid=6668 fields=Array x=8 y=6 Of course if I click on different spots of the image I get different numbers for x and y.
  4. Is it possible you mean to use $result and not $update in your if statement? if ($result) { header('Location: user_edited.php'); exit; }
  5. if ($update) { header('Location: user_edited.php'); exit; } Wouldn't this always be true after you assigned a value to '$update'?
  6. I did post the code That's all there is. I was thinking of trying extract() to see if that worked but the code works for regular variables but it stopped working for array variables. I don't think it is a php5 issue since it works on a linux server with php5 but this is on wampserver where it stopped working.
  7. Well suppose you have; <td><b>Select This Product</b><input type='text' name='foo' value='bar'></td> Then this code will create the variable $foo="bar"; foreach ($_POST as $key=>$value) { $$key=$value; }
  8. How about? foreach ($_POST['bar'] as $value) { $query = "INSERT INTO database VALUES ('', '$value'); }
  9. I often post arrays using html like this; <td><b>Select This Product</b><input type='checkbox' name='product[13]' value='550.92'></td> Then I use this code to assign local variable names to the posted variables in the $_POST global; foreach ($_POST as $key=>$value) { $$key=$value; } I recently upgraded a server and the code above no longer works if an element of $_POST is an array as above. I would normally expect to have an array $product after this ran but I get nothing. I even tried explicitly assigning $product=$_POST['product'] and it didn't work. The only way I can access the info is like this; foreach ($_POST['product'] as $key=>$value) { [some code] } Is this a result of upgrading php?
×
×
  • 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.