Search Results

Search found 42698 results on 1708 pages for 'php in array'.

Page 28/1708 | < Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • Better method for flipping multidimensional array?

    - by sudowned
    I've retrieved some data from the database, which is in the following structure: [0] [item_id] = 197 [dice_chat_css] = "foo" [dice_image] = "bar.png" [1] [item_id] = 128 [dice_chat_css] = "foo" [dice_image] = "bar.png" The most convenient and computationally inexpensive way for me to pass this data to the rest of my (PHP) application is with item_id as the index, because it saves having to loop over the array to look up values. If this was a flat array, I could accomplish this trivially with array_flip, but since it isn't, it's my pick of using either the multidimensional array_flip listed in the comments on PHP.net, or roll my own logic: for ($i = 0; $i < sizeOf($r); $i++){ $s[$r[$i]['item_id']]['dice_image'] = $r[$i]['dice_image']; $s[$r[$i]['item_id']]['dice_chat_css'] = $r[$i]['dice_chat_css']; } I know it's simple, but it feels like I'm reinventing the wheel here. Is there an accepted, more optimized method available or am I being weird about this?

    Read the article

  • Have problem changing a value in an array

    - by aliov
    I have a multi-dimensional array with 4 entries in each value - (1st name, last name, email, password). I am trying to format the password value so I can insert it into a database. As you can see, my results are not what I need. Why is this the result and what should I do to get my intended result? Thanks php > $newlines[1][3] = "PASSWORD($newlines[1][3)]"; php > echo $newlines[1][3]; PASSWORD(Array[3)]

    Read the article

  • Finding the index of a given value in a pre-sorted array

    - by bobo
    Today, I went for an interview and the interviewer asked me how I would find the index of a given value (number) in a pre-sorted array like this: $preSortedArr=array(23,32,36,41,45,54); He also said that using recursion is not allowed. I think the function should look like this: function findIndexByValue($preSortedArray,$value){ //some codes here } What solution do you think he was expecting from me? EDIT: sorry, I forgot to add that, he originally asked me to write psuedo codes but I said I don't know. I tried to write in PHP, but I think he's expecting a language-independent solution.

    Read the article

  • Write a foreach loop for array of SimpleXMLElements

    - by mjames
    Hi, I am using the XPath in PHP 5 to parse a XML document. The problem I have is writing a foreach to correctly display the following array: XML document sample value 1 value 2 $xmlfile = 'link_to_file.xml'; $xmlRaw = file_get_contents($xmlfile); $xml = new SimpleXMLElement($xmlRaw); $install_files = $xml->xpath('//files'); foreach($install_files as $row) { echo $row['file']; } //var_dump for $row gives the following array(1) { [0]=> object(SimpleXMLElement)#21 (2) { ["file"]=> string(12) "value 1" ["folder"]=> string(8) "value 2" } } Ideally I would like to get the value by using $row['file'] or $row['folder']. Thanks for any help.

    Read the article

  • echoing our parts of an Array?

    - by Wes
    I have the following array that I get as an output from facebook: http://www.paste.to/v/1jntlnml With the following code: $stream = $facebook->api_client->stream_get('',128342905144,'0','0',30,'','','',''); foreach($stream as $wallpost) { echo '<pre>'; print_r($wallpost); echo '</pre>'; } So I get the data that I need, but I want to call the individual variables within this array. For example, echo out the [message] for each post. Since it only loops once, I cant echo $wallpost['message'] or anything similar. any idea?

    Read the article

  • Convert array of hashes to array of structs?

    - by keruilin
    Let's say I have two objects: User and Race. User has two attributes: first_name, last_name. And Race has three attributes: course, start_time, end_time. Now let's say I create an array of hashes like this: user_races = races.map{ |race| {:user = race.user, :race = race} } How do I then convert user_races into an array of structs, keeping in mind that I want to be able to access the attributes of both user and race from the struct element?

    Read the article

  • PHP Sum Array - sum only elemants of an array

    - by Homer_J
    Hi all, I have have an array as follows: $row[6] This section of the array has 4 numbers within it that I can display and use without any problems, what I'd like to be able to do is sum the first two numbers and the last two numbers separately. Is there any way to do this? Thanks in advance, Homer.

    Read the article

  • PHP Beginner: How to pass PHP variable from one PHP code segment to another ?

    - by Misha Moroshko
    I have index.php which uploads a file to server and sets several PHP variables (like $target_folder_and_file_name). index.php also has the following line (it was originally index.html): <script language="JavaScript" src="main.js.php"></script> After index.php returned to the browser, the browsers asks for main.js.php from the server (right?). Can I access somehow $target_folder_and_file_name from the PHP code in main.js.php ?

    Read the article

  • Problem in searching String array [on hold]

    - by user2573607
    I'm working on a bank interface project, where I have to search an array of string when the user types in his username. The array has 10 strings, but only the first string is recognized as a valid username...I'm positive that the syntax of the search technique(Linear Search) is correct, but I cannot seem to find the problem. The code however compiles properly. Any answer will be appreciated, TIA! Aparna

    Read the article

  • PHP SoapClient() function returning a single XML string

    - by gjb
    I am having difficulty with the PHP SoapClient() function. The SOAP request is successful, but the response is returned as an object containing a single XML string with the key "any". For example: <?php $params = array('strUsername' => 'Test', 'strPassword' => 'Test'); $client=new SoapClient('http://www.example.com/webservice.asmx?wsdl', array('features' => SOAP_SINGLE_ELEMENT_ARRAYS)); $result = $client->strExampleCall($params); print_r($result); ?> This outputs the following: stdClass Object ( [strExampleCallResult] => stdClass Object ( [any] => <Response xmlns="" release="1.0.0" environment="Production" lang="en-GB"><ApplicationArea><Sender><SenderId>0</SenderId><ReferenceId>0</ReferenceId></Sender><Destination><DestinationId>1</DestinationId></Destination></ApplicationArea><DataArea><Result>1</Result></DataArea></Response> ) ) Subsequently, I cannot access properties of the object as I'd expect to: echo $result->strExampleCallResult->Response->DataArea->Result; Why isn't PHP parsing the SOAP response into properties of the returned object? I am using PHP 5.3.0 and believe the SOAP server is running .NET. Any suggestions will be much appreciated.

    Read the article

  • What Apache/PHP configurations do you know and how good are they?

    - by FractalizeR
    Hello. I wanted to ask you about PHP/Apache configuration methods you know, their pros and cons. I will start myself: ---------------- PHP as Apache module---------------- Pros: good speed since you don't need to start exe every time especially in mpm-worker mode. You can also use various PHP accelerators in this mode like APC or eAccelerator. Cons: if you are running apache in mpm-worker mode, you may face stability issues because every glitch in any php script will lead to unstability to the whole thread pool of that apache process. Also in this mode all scripts are executed on behalf of apache user. This is bad for security. mpm-worker configuration requires PHP compiled in thread-safe mode. At least CentOS and RedHat default repositories doesn't have thread-safe PHP version so on these OSes you need to compile at least PHP yourself (there is a way to activate worker mpm on Apache). The use of thread-safe PHP binaries is considered experimental and unstable. Plus, many PHP extensions does not support thread-safe mode or were not well-tested in thread-safe mode. ---------------- PHP as CGI ---------------- This seems to be the slowest default configuration which seems to be a "con" itself ;) ---------------- PHP as CGI via mod_suphp ---------------- Pros: suphp allows you to execute php scipts on behalf of the script file owner. This way you can securely separate different sites on the same machine. Also, suphp allows to use different php.ini files per virtual host. Cons: PHP in CGI mode means less performance. In this mode you can't use php accelerators like APC because each time new process is spawned to handle script rendering the cache of previous process useless. BTW, do you know the way to apply some accelerator in this config? I heard something about using shm for php bytecode cache. Also, you cannot configure PHP via .htaccess files in this mode. You will need to install PECL htscanner for this if you need to set various per-script options via .htaccess (php_value / php_flag directives) ---------------- PHP as CGI via suexec ---------------- This configuration looks the same as with suphp, but I heard, that it's slower and less safe. Almost same pros and cons apply. ---------------- PHP as FastCGI ---------------- Pros: FastCGI standard allows single php process to handle several scripts before php process is killed. This way you gain performance since no need to spin up new php process for each script. You can also use PHP accelerators in this configuration (see cons section for comment). Also, FCGI almost like suphp also allows php processes to be executed on behalf of some user. mod_fcgid seems to have the most complete fcgi support and flexibility for apache. Cons: The use of php accelerator in fastcgi mode will lead to high memory consumption because each PHP process will have his own bytecode cache (unless there is some accelerator that can use shared memory for bytecode cache. Is there such?). FastCGI is also a little bit complex to configure. You need to create various configuration files and make some configuration modifications. It seems, that fastcgi is the most stable, secure, fast and flexible PHP configuration, however, a bit difficult to be configured. But, may be, I missed something? Comments are welcome!

    Read the article

  • pgsql.so is not loaded in PHP

    - by Obay
    Hi, I've been tasked to create a PHP app which accesses an existing PostgreSQL database. This is my first time working with Postgre, not to mention the PHP has already been installed in the Linux box on which the app is supposed to run. I have no experience setting up this stuff, I just code. My question is that I can't seem to get the Postgre extension working in PHP. I checked the php.ini file, there were no "extension=..." lines. So I added "extension=pgsql.so". I then checked the "extension_dir" and found that there were only 2 files in there (ldap.so, phpcups.so), I added a pgsql.so file taken from another Linux box. I restarted httpd. And it does not work. I couldn't find any "pgsql" or "postgre" in phpinfo(). Forgive my noobness. I know too little Linux. I would really appreciate it if you can point me to the right direction.

    Read the article

  • php cli script hangs with no messages

    - by julio
    Hi-- I've written a PHP script that runs via SSH and nohup, meant to process records from a database and do stuff with them (eg. process some images, update some rows). It works fine with small loads, up to maybe 10k records. I have some larger datasets that process around 40k records (not a lot, I realize, but it adds up to a lot of work when each record requires the download and processing of up to 50 images). The larger datasets can take days to process. Sometimes I'll see in my debug logs memory errors, which are clear enough-- but sometimes the script just appears to "die" or go zombie on me. My tail of the debug log just stops, with no error messages, the tail of the nohup log ends with no error, and the process is still showing in a ps list, looking like this-- 26075 pts/0 S 745:01 /usr/bin/php ./import.php but no work is getting done. Can anyone give me some ideas on why a process would just quit? The obvious things (like a php script timeout and memory issues) are not a factor, as far as I can tell. Thanks for any tips PS-- this is hosted on a godaddy VDS (not my choice). I am sort of suspecting that godaddy has some kind of limits that might kick in on me despite what overrides I put in the code (such as set_time_limit(0);).

    Read the article

  • String to array or Array to string tips on formats, etc

    - by user316841
    hi, first of all thanks for taking your time! I'm a junior Dev, working with PHP + mysql. My issue: I'm saving data from a form to my database. From this form, there's only need to save the contacts: Name, phone number, address. But, it would be nice to have a small reference to the user answers. Let's say for each question we've got a value betwee 1 and 4. Since there's no need to create a table just for it, because what's needed is just the personal contacts. I'm thinking of recording each question/answer, as a letter and its correspondent value. Example (A2, B1, C5, D3, etc). My question is: Is there a format I could afterwards, handle easily ? Convert to array (string to array) in case the client change ideas, and ask this data, placed in table columns ? Just to prevent this situation! Example, From (A2, B1, C5 ) to array( "A" = "1", "B" = "1", "C" = "5" ) For now I guess, Regex is the answer, but it's allways hard to figure it out and I'm allways getting in troubles =) Thanks!

    Read the article

  • PHP/Java Bridge - Access Java objects in PHP

    - by Omer Hassan
    I have a Red5 application which defines some public Java methods. When I start the server, an object of the application class gets created. I am trying to call the public methods of the application class from PHP using the existing instance of the Java application class. So here's my Java application: public class App extends org.red5.server.adapter.ApplicationAdapter { public boolean appStart(IScope app) { // This method gets called when the application starts // and an object of this App class is created. return true; } // This is the method I would like to call from PHP. public void f() { } } From PHP, I would like to get access to the App object that is created and call the method f() on it. I have tried playing around with this thing called "context". So in the Java method App.appStart(), I did this: // Save a reference to this App object to be retrieved later in PHP. new PhpScriptContextFactory().getContext().put("x", this); And in PHP, I tried to access the saved object like this: require_once("http://localhost:5080/JavaBridge/java/Java.inc"); var_dump(java_is_null(java_context()->get("x"))); Unfortunately, the java_is_null() function in PHP returns true. I also tried saving the App object in a static variable of App class but when I access that variable in PHP, its value is null.

    Read the article

  • Running PHP scripts as the owner of the PHP file: security issues

    - by thomasrutter
    I'm using suexec to ensure that PHP scripts (and other CGI/FastCGI apps) are run as the account holder associated with the relevant virtual host. This allows for securing each users' scripts from reading/writing by other users. However, it occurs to me that this opens up a different security hole. Previously, the web server ran as an unprivileged user, with read-only access to user's files (unless the user changed the file permissions for some reason). Now, the web user can also write to user's files. So while I've prevented different users taking advantage of each other's scripts, I've made it so that in the event that some application has a remote code injection vulnerability, it now has not only read access but also write access to all that user's scripts and website. How can I deal with this? One idea I've had is to create a second user account for each user account in the system, so that each user has their own user account, and all their scripts are run under another user account. But that seems cumbersome.

    Read the article

  • Security issues of running PHP scripts as the owner of the PHP file with suexec

    - by thomasrutter
    I'm using suexec to ensure that PHP scripts (and other CGI/FastCGI apps) are run as the account holder associated with the relevant virtual host. This allows for securing each users' scripts from reading/writing by other users. However, it occurs to me that this opens up a different security hole. Previously, the web server ran as an unprivileged user, with read-only access to user's files (unless the user changed the file permissions for some reason). Now, the web server can also write to user's files. So while I've prevented different users taking advantage of each other's scripts, I've made it so that in the event that some application has a remote code injection vulnerability, it now has not only read access but also write access to all that user's scripts and website. How can I deal with this? One idea I've had is to create a second user account for each user account in the system, so that each user has their own user account, and all their scripts are run under another user account. But that seems cumbersome.

    Read the article

  • Uninitialized array offset

    - by kimmothy16
    Hey everyone, I am using PHP to create a form with an array of fields. Basically you can add an unlimited number of 'people' to the form and each person has a first name, last name, and phone number. The form requires that you add a phone number for the first person only. If you leave the phone number field blank on any others, the handler file is supposed to be programmed to use the phone number from the first person. So, my fields are: person[] - a hidden field with a value that is this person's primary key. fname[] - an input field lname[] - an input field phone[] - an input field My form handler looks like this: $people = $_POST['person'] $counter = 0; foreach($people as $person): if($phone[$counter] == '') { // use $phone[0]'s phone number } else { // use $phone[$counter] number } $counter = $counter + 1; endforeach; PHP doesn't like this though, it is throwing me an Notice: Uninitialized string offset error. I debugged it by running the is_array function on people, fname, lname, and phone and it returns true to being an array. I can also manually echo out $phone[2], etc. and get the correct value. I've also ran is_int on the $counter variable and it returned true, so I'm unsure why this isn't working as intended? Any help would be great!

    Read the article

  • PHP, is_array() generating an "Undefined property: stdClass::$crit " error

    - by Brook Julias
    is_array($src2->crit) is generating an "Undefined property: stdClass::$crit" error. The line throwing the error is: if(is_array($src2->crit) && count($src->crit) > 0){ $src2->crit is initialized here. $src2->crit = array(); $src2->crit[0] = new dataSet(); $src2->crit[0]->tblName = $tbl2; $src2->crit[0]->colName = "ID"; $src2->crit[0]->val = $elm->editID; When testing $src2->crit with this code. print("\$src->crit is a ".$src->crit."<br />"); print_r($src->crit); print("<br />"); This is returned. $src2->crit is a Array Array ( [0] => dataSet Object ( [tblName] => sExam [colName] => ID [val] => 10 ) ) What am I not seeing/understanding correctly? If print("\$src2->crit is a ".$src->crit."<br />") returns that it is an array then why is is_array($src2->$crit) generating an error?

    Read the article

  • PHP - uninitialized array offset

    - by kimmothy16
    Hey everyone, I am using PHP to create a form with an array of fields. Basically you can add an unlimited number of 'people' to the form and each person has a first name, last name, and phone number. The form requires that you add a phone number for the first person only. If you leave the phone number field blank on any others, the handler file is supposed to be programmed to use the phone number from the first person. So, my fields are: person[] - a hidden field with a value that is this person's primary key. fname[] - an input field lname[] - an input field phone[] - an input field my form handler looks like this: $people = $_POST['person'] $counter = 0; foreach($people as $person): if(phone[$counter] == '') { // use $phone[0]'s phone number } else { // use $phone[$counter] number } $counter = $counter + 1; endforeach; PHP doesn't like this though, it is throwing me an Notice: Uninitialized string offset error. I debugged it by running the is_array function on people, fname, lname, and phone and it returns true to being an array. I can also manually echo out $phone[2], etc. and get the correct value. I've also ran is_int on the $counter variable and it returned true, so I'm unsure why this isn't working as intended? Any help would be great!

    Read the article

  • How to get an array to check in the in_array function? See description Below...

    - by Parth
    I am fetching the data using mysql_fetch_array like : while($row = mysql_fetch_array($select)) { $tables[] =$row; } Now i need this $tables array as one dimensional array only, so that i can use it in if(in_array($val['table_name'],$tables)) { //Some Code } to check for whether the $val['table_name'] is in the $tables or not.. As for now I am getting $tables array as Array ( [0] => Array ( [TABLE_NAME] => jos_audittrail ) [1] => Array ( [TABLE_NAME] => jos_banner ) [2] => Array ( [TABLE_NAME] => jos_bannerclient ) .. .. .. .. } But I need the $tables is form of.. Array ( [0] => jos_audittrail [TABLE_NAME] => jos_audittrail [1] => jos_banner [TABLE_NAME] => jos_banner [2] => jos_bannerclient [TABLE_NAME] => jos_bannerclient .. .. .. } How can i get the above array after applying "while loop" to "$row"?

    Read the article

  • PHP | SQL syntax error when inserting array

    - by Philip
    Hi guys, I am having some trouble inserting an array into the sql database. my error is as follows: Unable to add : 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 '06:45:23,i want to leave a comment)' at line 1 My query var_dump is: string(136) "INSERT INTO news_comments (news_id,comment_by,comment_date,comment) VALUES (17263,Philip,2010-05-11 06:45:23,i want to leave a comment)" My question is how can i add an empty value to id as it is the primary key and not news_id my insert function looks like this: function insertQuery($tbl, &$data) { global $mysqli; $_SESSION['errors'] = array(); require_once '../config/mysqli.php'; $query = "INSERT INTO $tbl (".implode(',',array_keys($data)).") VALUES (".implode(',',array_values($data)).")"; var_dump($query); if($result = mysqli_query($mysqli, $query)) { //$id = mysqli_insert_id($mysqli); print 'Very well done sir!'; } else { array_push($_SESSION['errors'], 'Unable to add : ' . mysqli_error($mysqli)); } } Note: arrays are not my strong point so i may be using them in-correctly!

    Read the article

  • PECL OCI8 2.0 Production Release Announcement

    - by cj
    The PHP OCI8 2.0.6 extension for Oracle Database is now "production" status. The source code is available on PECL. This can be used immediately to update your OCI8 extension in PHP 5.2 and later versions. The extension compiles with Oracle 10.2 or later client libraries. Oracle's standard cross-version database connectivity applies. OCI8 2.0 and PHP 5.5.5 RPMs for Oracle and Red Hat Linux are available from oss.oracle.com. Windows DLLs are available on PECL for PHP 5.3, PHP 5.4 and PHP 5.5. OCI8 2.0 source code will also be automatically included in the next major version of PHP. New Functionality Oracle Database 12c Implicit Result Set support. IRS's make it easy to pass query results back from stored PL/SQL procedures or anonymous PL/SQL blocks. Individual IRS statement resources, each corresponding to a single query, can be obtained with the new function oci_get_implicit_resultset(). These 'child' statement resources can be passed to any oci_fetch_* function. See Using PHP and Oracle Database 12c Implicit Result Sets and the PHP Manual: oci_get_implicit_resultset(). DTrace Dynamic Trace static probes. This well respected DTrace tracing framework is available on a number of platforms, including Oracle Linux. PHP OCI8 static user-space probes can be enabled with PHP's --enable-dtrace configuration option. See Using PHP DTrace on Oracle Linux. Documentation is also available in the PHP Manual OCI8 and DTrace Dynamic Tracing Improved Functionality Using oci_execute($s, OCI_NO_AUTO_COMMIT) for a SELECT no longer unnecessarily initiates an internal ROLLBACK during connection close. This can improve overall scalability by reducing "round trips" between PHP and the database. Changed Functionality PHP OCI8 2.0's minimum pre-requisites are now PHP 5.2 and Oracle client library 10.2. Later versions of both are usable and, in fact, recommended. Use the older PHP OCI8 1.4.10 extension when using PHP 4.3.9 through to PHP 5.1.x, or when only Oracle Database 9.2 client libraries are available. oci_set_*($connection, ...) meta data setting call error handling is fixed so that oci_error($connection) works for these calls. Note: The old, deprecated function aliases like ocilogon still exist but are not recommended for new applications. Phpinfo() Changes Some cosmetic changes were made to the output of php --ri oci8 and the phpinfo() function. The oci8.event and oci8.connection_class values are now shown only when the Oracle client libraries support the respective functionality. Connection statistics are now in a separate phpinfo() table. Temporary LOB and Collection support status lines in phpinfo() output were removed. These two features have always been enabled since 2007. Oci_internal_debug() Changes The oci_internal_debug() function is now a no-op. Use PHP's --enable-dtrace functionality with DTrace or SystemTap instead. References OCI8 Extension source code and Windows DLLs http://pecl.php.net/package/oci8 Oracle Linux RPMs oss.oracle.com PHP Manual for OCI8 OCI8 and DTrace Dynamic Tracing Oracle OpenWorld Conference paper What's New in Oracle Database 12c for PHP

    Read the article

  • PROBLEM: PHP strip_tags & multi-dimensional array form parameter

    - by Tunji Gbadamosi
    I'm having problems stripping the tags from the textual inputs retrieved from my form so as to do something with them in checkout.php. The input is stored in a multi-dimensional array. Here's my form: echo '<form name="choose" action="checkout.php" method="post" onsubmit="return validate_second_form(this);">'; echo '<input type="hidden" name="hidden_value" value="'.$no_guests.'" />'; if($no_guests >= 1){ echo '<div class="volunteer">'; echo '<fieldset>'; echo '<legend>Volunteer:</legend>'; echo '<label>Table:</label>'; echo '<select name="volunteer_table">'; foreach($tables as $t){ echo '<option>'.$t.'</option>'; } echo '</select><br><br>'; echo '<label>Seat number:</label>'; echo '<select name="volunteer_seat">'; foreach($seats as $seat){ echo '<option>'.$seat.'</option>'; } echo '</select><br><br>'; //echo '<br>'; echo '</fieldset>'; echo '</div>'; for($i=0;$i<$no_guests;$i++){ $guest = "guest_".$i; echo '<div class="'.$guest.'">'; echo '<fieldset>'; echo '<legend>Guest '.$i.':</legend>'; echo '<label>First Name:</label>'; echo '<input type="text" name="guest['.$i.']['.$first_name.']" id="fn'.$i.'">'; echo '<label>Surname:</label>'; echo '<input type="text" name="guest['.$i.']['.$surname.']" id="surname'.$i.'"><br><br>'; echo '<label>Date of Birth:</label> <br>'; echo '<label>Day:</label>'; echo '<select name="guest['.$i.'][dob_day]">'; for($j=1;$j<32;$j++){ echo"<option value='$j'>$j</option>"; } echo '</select>'; echo '<label>Month:</label>'; echo '<select name="guest['.$i.'][dob_month]">'; for($j=0;$j<sizeof($month);$j++){ $value = ($j + 1); echo"<option value='$value'>$month[$j]</option>"; } echo '</select>'; echo '<label>Year:</label>'; echo '<select name="guest['.$i.'][dob_year]">'; for($j=1900;$j<$year_limit;$j++){ echo"<option value='$j'>$j</option>"; } echo '</select> <br><br>'; echo '<label>Sex:</label>'; echo '<select name="guest['.$i.']['.$sex.']">'; echo '<option>Female</option>'; echo '<option>Male</option>'; echo '</select><br><br>'; echo '<label>Table:</label>'; echo '<select name="guest['.$i.']['.$table.']">'; foreach($tables as $t){ echo '<option>'.$t.'</option>'; } echo '</select><br><br>'; echo '<label>Seat number:</label>'; echo '<select name="guest['.$i.']['.$seat_no.']">'; foreach($seats as $seat){ echo '<option>'.$seat.'</option>'; } echo '</select><br><br>'; //echo '<br>'; echo '</fieldset>'; echo '</div>'; } } else{ echo '<div id="volunteer">'; echo '<fieldset>'; echo '<legend>Volunteer:</legend>'; echo '<label>Table:</label>'; echo '<select name="volunteer['.$table.']">'; foreach($tables as $t){ echo '<option>'.$t.'</option>'; } echo '</select><br><br>'; echo '<label>Seat number:</label>'; echo '<select name="volunteer['.$seat_no.']">'; foreach($seats as $seat){ echo '<option>'.$seat.'</option>'; } echo '</select><br><br>'; //echo '<br>'; echo '</fieldset>'; echo '</div>'; } echo '<input type="submit" value="Submit form">'; echo '</form>'; here's checkout.php: if(isset($_POST['guest'])){ foreach($_POST['guest'] as $guest){ $guest['first_name'] = strip_tags($guest['first_name']); $guest['surname'] = strip_tags($guest['surname']); } //$_SESSION['guest'] = $guests; }

    Read the article

< Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >