-
Posts
44 -
Joined
-
Last visited
Never
Everything posted by vikela
-
Have managed to get the other selected options shown but now the selected options are being repeated any workaround.Whats the best way forward <select multiple="true" name="user_id[]" id="the_user_id" size="6"> <?php $repeat; $finder=unserialize($info[0]['user_id']); foreach($allusers as $rows){ foreach($finder as $value){ $bigg=($rows['user_id']==$value)?'selected':NULL; if($repeat!='<option value ="'.$rows['user_id'].'" '.$bigg.'>'.$rows['user_name'].' </option>') { echo $repeat; $repeat='<option value ="'.$rows['user_id'].'" '.$bigg.'>'.$rows['user_name'].' </option>'; } } } ?> </select>
-
Have managed to get the other selected options shown but now the selected options are being repeated any workaround? I am still fresh on PHP <select multiple="true" name="user_id[]" id="the_user_id" size="6"> <?php $repeat; $finder=unserialize($info[0]['user_id']); foreach($allusers as $rows){ foreach($finder as $value){ $bigg=($rows['user_id']==$value)?'selected':NULL; if($repeat!='<option value ="'.$rows['user_id'].'" '.$bigg.'>'.$rows['user_name'].' </option>') { echo $repeat; $repeat='<option value ="'.$rows['user_id'].'" '.$bigg.'>'.$rows['user_name'].' </option>'; } } } ?> </select> > :shrug: :o ;D :'( :'(
-
Thanks. Did try but its no longer duplicating however its showing only 1 selected option instead of say 3.
-
Here is the scenario..I have a database with 2 tables 1 for users contact details and the other has user comments and preferences.In the table of comments I have one field I want to contain multiple values.However, I am able to upload the multiple values(through serialize and unserialize) and retrieve them but the problem I am now having is on editing the multiple values.I am using multiple select.The following code is duplicating the users in the select menu. <select multiple="true" name="user_id[]" id="the_user_id" size="6"> <?php $finder=unserialize($info[0]['user_id']);//from comments table foreach($finder as $value) foreach($allusers as $rows){ $bigg=($rows['user_id']==$value)?'selected':NULL; echo '<option value ="'.$rows['user_id'].'" '.$bigg.'>'.$rows['user_name'].'</option>'; } ?> </select>
-
its showing me the php server configuration settings its a PHP Version 5.2.9.
-
now its showing a blank page..
-
I developed a small php application and is running perfect on my local xampp server.The problem is that when i uploaded to the online(internet) server everything is not alright.I have been trying to configure the online (internet)server but no success yet.For example the following simple code.. <?php //session_start(); //error handler function function customError($errno, $errstr) { echo "<b>Error:</b> [$errno] $errstr<br />"; echo "Ending Script"; die(); } //set error handler set_error_handler("customError",E_ALL); //trigger error $prove=5; if ($prove>1) { trigger_error("Value must be 1 or below",E_ALL); } ?> is producing something like this... Error: [$errno] $errstr "; echo "Ending Script"; die(); }//set error handlerset_error_handler("customError",E_ALL);//trigger error$prove=5;if ($prove>1) { trigger_error("Value must be 1 or below",E_ALL); } >:
-
Mail not Sent! obvious
-
That was the first thing before the $sendto and got no joy..
-
I would like to send an email using the php email() function then if it does execute i.e sends i would like to update a particular field in my db.however no matter how hard i try to the code seem to defy simply logic.here is the original code i have include_once("mailer.php"); $thesend=mail($toto1,$subject1,$message,$headers); if($thesend) { $mail_went=1; $_SESSION['msgstatus']= "Mail sent to ".$toto1."<br>"; }else{ $mail_went=0; $_SESSION['msgstatus']= "Mail send failure - message not sent <br>"; } the funny part is that the code executes the else and actually gives me the Mail send failure message yet i do receive the mail in my box???? However if i do change this to be like this include_once("mailer.php"); $thesend=mail($toto1,$subject1,$message,$headers); if(!$thesend) { $mail_went=1; $_SESSION['msgstatus']= "Mail sent to ".$toto1."<br>"; }else{ $mail_went=0; $_SESSION['msgstatus']= "Mail send failure - message not sent <br>"; } ........all works perfect what am i missing.The $message is an HTMl doc and the MIME and content-type are ok. Damn
-
from what you are saying i must say you have a trick scenario but from my research and little exprience you should try Kohana or Yii which i feel have a not so steep learning curve than Zend.
-
Thanks you are a star!i must admit i did try my best to decode the syntax but then my best was not enough but then my php experience is growing!!
-
still throughing Parse error now its :Parse error: syntax error, unexpected '{' in... on line 30 and lines 20- 33 and is $used_ranks = array(); foreach($news as $record) { if (!in_array($record['rank'],$used_ranks)) { $used_ranks[] = $record['rank']; } } //Get the diffrence of $all_ranks and $used_ranks (i.e. the unused ranks) $unused_ranks = array_diff($all_ranks,$used_ranks); //Create the options for select list $unused_rank_options = '';
-
Parse error: syntax error, unexpected ','... is the error i have got from the code and its the following lines //Create an array of the valid options $all_ranks = range(1,7); //Create new array and fill with used ranks $used_ranks = array(); of the following code <?php //Create an array of the valid options $all_ranks = range(1, 10); //Create new array and fill with used ranks $used_ranks = array(); foreach ($find as $record) { if (!in_array($record['rank']), $used_ranks) { $used_ranks[] = $record['rank']; } } //Get the diffrence of $all_ranks and $used_ranks (i.e. the unused ranks) $unused_ranks = array_diff($all_ranks, $used_ranks); //Create the options for select list $unused_rank_options = ''; foreach ($unused_ranks as $rank) { $unused_rank_options .= "<option value="{$rank}">{$rank}</option> " } ?> Rank: <select name="rank"> <?php echo $unused_rank_options; ?> </select> i did try a number of things even var_dumping but still getting the parse error
-
here is the challenge i am facing.i have a field that contains integers ranging from 1 to 10.how can i pull and display in a select menu numbers that are not yet in the field.i was thinking of creating an array of numbers that range (1-10) then compare with the numbers within the field but i am somehow failing to have the comparison work.. > :'( $arr=array(1,2,3,4,5,6,7); foreach($find as $test ){ if(in_array($test['rank'],$arr)){ echo "NUMBER ... is present"; } else{ echo "TESTTTTTTTTT"; } } whats my challenge?i would like it to show me the numbers that are not in the field 'rank' and this actually will be in a select menu so that a user select any of the non used number.
-
here is the challenge i am facing.i have a field that contains integers ranging from 1 to 10.how can i pull and display in a select menu numbers that are not yet in the field.i was thinking of creating an array of numbers that range (1-10) then compare with the numbers within the field but i am somehow failing to have the comparison work.. > :'( $arr=array(1,2,3,4,5,6,7); foreach($find as $test ){ if(in_array($test['rank'],$arr)){ echo "NUMBER ... is present"; } else{ echo "TESTTTTTTTTT"; } } whats my challenge?i would like it to show me the numbers that are not in the field 'rank' and this actually will be in a select menu so that a user select any of the non used number.
-
hi suppose i have a table with a column that can have values of between 1 and 10 only and i would like to display on a user form values that are not yet in the column.i would like the values to be in a select menu.so far i have something like this.. <?php foreach ($find as $rows){ if(!in_array($rows['rank'],$arr)){ ?> <option value="<?php echo $value; } ?>" <?php if($value!=$rows['rank']) {echo "selected=\"selected\"";} ?>><?php echo $value; ?></option><?php} } ?>
-
i have the following code which i am trying to figure out how to retrieve the values and insert in a db. its a code that would allow a user to sort elements and then commit the new arrangement onto the db. one way i am told is to use the parse_str($_POST['data']).i can connect to my db withouth any problem. <script type="text/javascript" src="../scripts/prototype.js"></script> <script type="text/javascript" src="../scripts/scriptaculous.js"></script> <script type="text/javascript"> window.onload = function() { Sortable.create('events',{tag:'li'}); } function serialize(container, name){ $('display').innerHTML = 'Serialization of ' + $(container).id + ' is: <br/><pre>' + Sortable.serialize( container,{ name:name} ) + '</pre>'; } </script> <style type="text/css"> li { cursor: move; } </style> </head> <body> <p>Drag and drop list items to sort them out!</p> <ul id="events"> <li id="event_1">Event 1</li> <li id="event_2">Event 2</li> <li id="event_3">Event 3</li> <li id="event_4">Event 4</li> <li id="event_5">Event 5</li> <li id="event_6">Event 6</li> </ul> <button type="button" value="Click Me" onclick="serialize('events', 'event')"> Serialize </button>