September 18th, 2000, 02:24 AM
-
Hi,
My problem for today is: 
How to select and print the result!
My HTML
-------
<select name="rating" size="1">
<option name="select[]" value="5">5 - Excellent, Extremely Useful</option>
<option name="select[]" value="4">4 - Very Good, Useful</option>
<option name="select[]" value="3">3 - Good, I learned something</option>
<option name="select[]" value="2">2 - Ok, but not really that useful</option>
<option name="select[]" value="1">1 - Not Useful At All, Sorry</option>
</select><input type="submit" value="Submit"></p>
</form>
PHP
---
if (sizeof($name) > 0) {
echo "<br>".implode(",",$select);
}
September 18th, 2000, 03:32 AM
-
Hi Dalida:
The var $name is not defined in your "select" statement.
Try changing: if (sizeof($name) > 0)
...to...
if (sizeof($rating) > 0)
...not definatively sure that this is the solution. Good luck.
//ryan
September 18th, 2000, 09:38 AM
-
The html you generate is incorrect. There is no "name=" attribute to the <option> tag in html. It will be ignored, however, by a most html clients & browsers. Once your form is submitted to a php script, the variable $rating will have a value of either 1,2,3,4,or 5. To find out what the user chose on the form, simply:
echo( "The user chose ".$rating."<br>" );
------------------
~Chris
September 19th, 2000, 09:55 AM
-
My HTML
-------
<select name="rating" size="1">
<option name="select[]" value="5">5 - Excellent, Extremely Useful</option>
<option name="select[]" value="4">4 - Very Good, Useful</option>
<option name="select[]" value="3">3 - Good, I learned something</option>
<option name="select[]" value="2">2 - Ok, but not really that useful</option>
<option name="select[]" value="1">1 - Not Useful At All, Sorry</option>
</select><input type="submit" value="Submit"></p>
</form>
PHP
---
if (sizeof($name) > 0) {
echo "<br>".implode(",",$select);
}
Try something like this...
My HTML
-------
<select name="rating[]" size="1">
<option value="5">5 - Excellent, Extremely Useful</option>
<option value="4">4 - Very Good, Useful</option>
<option value="3">3 - Good, I learned something</option>
<option value="2">2 - Ok, but not really that useful</option>
<option value="1">1 - Not Useful At All, Sorry</option>
</select>
<input type="submit" value="Submit"></p>
</form>
PHP
---
if (count($rating[]) > 0) {
//echo "<br>".implode(",",$rating);
}
------------------
SR -
webshiju.com
www.jobxyz.com-IT Career Portal
ezipindia.com--WebStudio
"The fear of the LORD is the beginning of knowledge..."
September 19th, 2000, 10:14 AM
-
Go with Shiju, except i don't know why you need the var to be an array. There is only one value you need so i suggest simply name="rating"
If its supposed to be able to have multiple selections try something like...
<select name="rating" multiple size="3">
Basil
September 19th, 2000, 11:00 PM
-
Everything is working. Thank you!