Jump to content

jimleeder123

Members
  • Posts

    84
  • Joined

  • Last visited

Everything posted by jimleeder123

  1. I'm making my own CMS inspired by Joomla/Virtuemart. I've got the products echoed out from the database, each has a hidden field with a name which is auto incremented (0 for first product shown, 1 for the next, 2 for the next etc). What I want to do is to post this info onto a process page, store them into sessions so that I can show the sessions in a cart.
  2. Ok so on the initial page I have auto incremented hidden input box names so it appears like "cart0Pizzas", "cart1Pizzas", "cart2Pizzas" etc. I am posting these to a process page (user won't see this page - is just so i can post the data and store it into sessions. I want to store the appropiate post data into auto incremented sessions. So when the user clicks on the submit button which is in the same form as for example "cart24Pizzas" it will go into $_SESSION['cart0'] if that one isn't set. If it is, then it can go into $_SESSION['cart1']. If that is set, it will go into $_SESSION['cart2'] and so on. How can I do this? Thanks in advance.
  3. This has been fixed via http://stackoverflow.com/questions/9552023/post-variable-name-is-variable-how-to-retrieve
  4. Ok, I've got this code include "includes/connect.php"; $groupid = $_POST['hidden']; //id for the attribute group $number = $_POST['hiddennumber']; //number of fields entered $i = 0; echo "number "; echo $number; echo "<br /> <br />"; for ($i=0;$i<$number;$i++){ //to find the auto increment on option post names //$option = $_POST['option$1']; // for testing - shows options entered echo "LLL: "; echo $_POST["option$i"]; echo "<br /> <br />"; $query = "INSERT INTO attributeoptions (attopt_group_id, attopt_name) VALUES ('$groupid', '$option".$i."')"; $result = mysql_query($query) or die (mysql_error()); } But it is inserting the post values as the auto increment numbers ( $i ). How can I get it to put the actual values in the Post? (When I echo them out as shown above it shows the actual text I enter into the text boxes) I have tried doing $option$id and a whole lot of other methods to put the Post data in a variable.
  5. When I send the data in the mysql query, I will be adding the post data to the database ($_POST['option0'], option1, option2 etc). How can I find the data here or am I better to just have all their names as "option" and add them in like that with mysql?
  6. Just one more thing needed for this - on the page where I am inserting the post data into the mysql database (data from the form posted to this page), I want to add auto increment to $_POST['option'] so its option0, option1, option 2 etc. How can I add the auto increment to this?
  7. I tried it with the for loop as Muddy wrote and it works, thanks!
  8. I've got the input boxes coming up. I am trying to add an auto increment on the "name" so I can then post it onto the next page and add each field to the database. Heres my code - $optid=1; echo str_repeat('Option <br /> <input type="text" name="option'.$optid.'" /> <br /> <br />', $number); $optid++; It's echoing the name as "option1" every time, but I want it to be option2, option3 and so on.
  9. I'm making my own CMS for my company so going through making the pages for the back end. What I want to do that I'm stuck on is -------------- I want to allow the user to specify how many input text fields they want shown on the page. I'm thinking that they could write a number then click submit, send the data to the same page (PHP self or action blank) and then the required amount of input fields would be echoed out. Echoing out is easy, I want to know how to find out how many fields are required, and then process it. Thanks in advance.
×
×
  • 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.