RE: Select Values Didn't Get Passed in From Two Different Forms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 9:19 PM -0400 5/27/10, Alice Wei wrote:

I am not sure how to add to the page you have set up, but here is the code with ther portion you have set up:


<?php
  $start = isset($_POST['start']) ? $_POST['start'] : null;
?>
    <form action="" method="post">
      <p>
        Select the type of your starting point of interest:<br>
<input type="text" name="start" value="<?php echo($start);?>" size="20" ><br />
        Which Semster is this: <select name="semester">
                        <option value="Fall">Fall</option>
                        <option value="Spring">Spring</option>
                        <option value="Summer">Summer</option>
                    </select><br/>
        <input type="submit" name="submit" value="Submit" >
      </p>
    </form>

 Note, what I provided here does not include anything on the ajax.

Hope this answers your question.

Alice :

I didn't have a question, but here's my revision of your code:

http://www.webbytedd.com/cccc/alice1/

Please review the code and see how: 1) I captured the select value; 2) and how I used that value to focus the selected option.

You say:

 Note, what I provided here does not include anything on the ajax.

I've never put anything "on the ajax" -- that doesn't make sense.

Ajax is simply a way to communicate from the browser to the server and back again without requiring a browser refresh. As the user triggers a client-side event (i.e., click, select, enter text, move a mouse, whatever), a javascript routine then sends data to the server to activate a server-side script, which may, or may not, return data.

For example -- with javascript turned ON please review:

http://www.webbytedd.com/a/ajax-site/

This is simply a one page template that uses an ajax routine to retrieve data from the server to populate the page based upon what the user triggers (i.e., the visitor clicks a navigational link).

If you will review the HTML source code, you will find a very basic HTML template that will remain static for all three "apparent" pages. If you use the FireFox browser you can review the generated HTML.

Now where did the generated HTML come from, you might ask? It came from the server after a request was made from the client to the server and the server responded with the correct data -- all without requiring a browser refresh. That's an example of how ajax works.

Keep in mind that using "best practices" requires you to *first* design forms to collect data WITHOUT requiring javascript and then you can enhance the form to provide additional functionality to those who have javascript turned on. Also keep in mind that you may not need ajax to alter the form. You only need ajax if there is data on the server that needs to be retrieved.

Now, please turn javascript OFF in your browser and review my page again:

http://www.webbytedd.com/a/ajax-site/

That's an example of NOT following "best practices". The visitor is provided nothing if they have javascript turned OFF.

Now considering such, what additional functionality do you want your form to do that can't be done already?

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux