Jump to content

[SOLVED] problem with option tags


ekante

Recommended Posts

Where is problem, why doesnt it assign anything to $status ?

 

<?php

echo '		<tr>
		<td width=\"150\" align=\"right\">Tava karjera :</td>
			<td><select name=\"Chose\">
				<option value=\"$select_waiting\">Simple User</option>
				<option value=\"$select_pilot\">Pilot</option>
				<option value=\"$select_manager\">Manager</option>
			</select>* $user_taken_err</td>
	</tr>';

			if (isset($select_waiting)) {
				$status = "waiting";
			}
			if (isset($select_manager)) {
				$status = "manager";
			}
			if (isset($select_pilot)) {
				$status = "pilot";
			}
?>

Link to comment
https://forums.phpfreaks.com/topic/155023-solved-problem-with-option-tags/
Share on other sites

You don't quite understand how PHP works and separation of Server Side and Client Side code.

 

HTML is Client Side code. Basically, your webserver passes a text file with a bunch of HTML tags and text in it to the client's browser. The client's browser then interprets this text file and renders it as a webpage.

 

PHP is Server Side code. It it used to make the text file that is sent to the client's browser more dynamic.

 

So, all the steps that happen are as follows:

-Client requests webpage

-Server receives request and gets file being requested

-Server sends the file through the PHP parser

-Server sends render text file to client

-Client receives text file

-Client parses HTML and renders the webpage

 

Now, if you want to send data from the client back to the server, you need to make another request and pass the data with it (usually in the form of a form). Here is a basic example of a form post:

<?php
  if($_SERVER['REQUEST_METHOD'] == 'POST'){
    print "You selected ".$_POST['fruit'];
    exit;
  }
?>
<form method="post" action="">
  <select name="fruit">
    <option>Apple</option>
    <option>Orange</option>
    <option>Banana</option>
  </select>
  <input type="submit" value="Submit" />
</form>

 

Here is a good, thorough tutorial on PHP if you are interested: http://devzone.zend.com/node/view/id/627

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.