redarrow Posted October 12, 2006 Share Posted October 12, 2006 Hello all advance thank you..I was showing a person how to create a select list with a array and i got told it's wrong am i going mad cheers.[code]<?php$eq=($_POST['eq']);if($_POST['submit']) {echo $eq;}echo"<form method='POST' action='".$_SERVER['PHP_SELF']."'>";echo"<select name='eq'>";$list=array("computers","motherboard","ram","case","monitor");foreach($list as $eq){echo"<option value='$eq'>$eq</option>";}echo"</select>";echo"<input type='submit' name='submit' value='send'>";?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/23751-solved-user-get-a-bookselect-list-with-array/ Share on other sites More sharing options...
HuggieBear Posted October 12, 2006 Share Posted October 12, 2006 What were you told was wrong about it, it looks OK to me.RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/23751-solved-user-get-a-bookselect-list-with-array/#findComment-107862 Share on other sites More sharing options...
redarrow Posted October 12, 2006 Author Share Posted October 12, 2006 I was told it not the correct way in php to do a select form but i think it's correct. Quote Link to comment https://forums.phpfreaks.com/topic/23751-solved-user-get-a-bookselect-list-with-array/#findComment-107863 Share on other sites More sharing options...
HuggieBear Posted October 12, 2006 Share Posted October 12, 2006 It's nothing to do with php, it's to do with HTML, and there's nothing wrong with that.Links to check the syntax of both [url=http://www.w3schools.com/tags/tag_select.asp]<select>[/url] and [url=http://www.w3schools.com/tags/tag_option.asp]<option>[/url][code]<select name="model"> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="opel">Opel</option> <option value="audi">Audi</option></select>[/code]RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/23751-solved-user-get-a-bookselect-list-with-array/#findComment-107865 Share on other sites More sharing options...
redarrow Posted October 12, 2006 Author Share Posted October 12, 2006 thanks mate.i get the inpression they dont understand php or html my code is bang on cheers huggie mate. Quote Link to comment https://forums.phpfreaks.com/topic/23751-solved-user-get-a-bookselect-list-with-array/#findComment-107869 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.