-
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>
-
how can i have jquery validate a field that would have been revealed through a radio button.I have two radio buttons and depending on what a user select a textarea is shown for them to put info.how then can i validate the info that a user would have put using jquery? the code i have is as follows and is working fine except the validation of the text. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript"><!-- if(document.all && !document.getElementById) { //IE4 support document.getElementById = function(id) { return document.all[id]; } } function dss_addLoadEvent(fn) { if(typeof(fn)!="function")return; var tempFunc=window.onload; window.onload=function() { if(typeof(tempFunc)=="function")tempFunc(); fn(); } } dss_addLoadEvent(function() { if(!document.getElementById) return; var f = document.getElementById('form1'); //f.onsubmit = function(){ return false; } // hide the textarea and its parent label document.getElementById('demo_radio_ta_label').style.display = 'none'; document.getElementById('demo_radio_ta_label1').style.display = 'none'; // get a reference to the radio button group var rads = f.elements['demo_radio']; for(var i=0;i<rads.length;i++) { // we add the event handler to each button in the group rads[i].onkeyup=rads[i].onclick=function(){ if(!this.checked) return; var el = document.getElementById('demo_radio_ta_label'); el.style.display = (this.value=="yes")?'':'none'; var el1 = document.getElementById('demo_radio_ta_label1'); el1.style.display = (this.value=="no")?'':'none'; } // in case, for any reason, one of the radio buttons is already checked rads[i].onclick(); } }); // --> </script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Category For Registration Form</title> </head> <body> <form id="form1" action="#"> <legend>Choose your category?</legend> <label for="rad1"><input type="radio" name="demo_radio" id="rad1" value="yes" > Trustee</label><br> <label for="rad2"><input type="radio" name="demo_radio" id="rad2" value="no" > Broker</label> <div class="label" id="demo_radio_ta_label"><label >Trustee Name:</label> <input type="text" name="trustee"></div> <div class="label" id="demo_radio_ta_label1"><label >Broker:</label> <input type="text" name="broker"></div> </form> </body> </html> </body> </html>
-
i am trying to store old record in another table whenever new record is being recorded.i have a form that can update a table but i would like to capture the old record before the new record is recorded and so far i am have the following code which can add a new row but without the record .......if ((isset($_POST["submit"])) { $backup="Insert into Member_old SET member_id='$theid', description='$mydesc', favor_music='$favmusic',favor_website='$favweb'"; $Result1 = mysql_query($backup, $moving) or die(mysql_error()); $update = sprintf("UPDATE Member SET description=%s, favor_music=%s, favor_website=%s WHERE member_id = $theid", GetSQLValueString($_POST['description'], "text"), GetSQLValueString($_POST['favor_music'], "text"), GetSQLValueString($_POST['favor_website'], "text"), $Result = mysql_query($update, $moving) or die(mysql_error()); mysql_select_db($database_moving, $moving); } $query_updater = "SELECT * FROM Member WHERE member_id = $theid"; $updater = mysql_query($query_updater, $moving) or die(mysql_error()); $row_updater = mysql_fetch_assoc($updater); $totalRows_updater = mysql_num_rows($updater); $mydesc=$row_updater['description']; $favmusic=$row_updater['favor_music']; $favweb=$row_updater['favor_website']; $favact=$row_updater['favor_activity']; <form method="post" name="formb" action="<?php echo $_SERVER['PHP_SELF'];?>"> <table border="0" align="left"> <tr valign="baseline"> <td colspan="3" align="right" valign="top" nowrap> </td> </tr> <tr valign="baseline"> <td colspan="2" align="right" valign="top" nowrap><span class="style13">Description:</span></td> <td align="left"><strong> <textarea name="description" cols="50" rows="3"><?php echo $mydesc; ?></textarea> </strong></td> </tr> <tr valign="baseline"> <td colspan="2" align="right" nowrap><span class="style13">Favourite Music:</span></td> <td align="left"><input name="favor_music" type="text" value="<?php echo $row_updater['favor_music']; ?>" size="32"></td> </tr> <tr valign="baseline"> <td colspan="2" align="right" nowrap><span class="style13">Favourite Website:</span></td> <td align="left"><input name="favor_website" type="text" value="<?php echo $row_updater['favor_website']; ?>" size="32"></td> <input type="submit" value="Update Profile " name="submit"></td> </tr> </table> <input type="hidden" name="MM_update" value="formb"> </form>........
-
i have a table that will have an auto increment field,and i would like to retrieve the record with the biggest number and show the record.how can i be able to do the sql statement because i have tried with the limit but no joy.
-
i am trying to figure out what does the following code and how best i can shorten it?it is part of a flash poll code. $URL = ''; $URL .= (($_SERVER['HTTPS'] != '') ? "https://" : "http://"); $URL .= (($www == true && !preg_match("/^www\./", $_SERVER['HTTP_HOST'])) ? 'www.'.$_SERVER['HTTP_HOST'] : $_SERVER['HTTP_HOST']);
-
i have been trying to insert the following into mysql but no joy.the error i am getting is string(0) "" if($_SERVER['REQUEST_METHOD'] == "post") { $month=$_POST['month']; $day=$_POST['day']; $year=$_POST['year']; $dob = $year.'-'.$month.'-'.$day; $gender = $_POST['gender']; $race = $_POST['race']; $segment = $_POST['segment']; $region = $_POST['region']; mysql_query("INSERT INTO PanelMember (date_of_birth, gender, race, segment, region) VALUES('$dob','$gender','$race','$segment','$region' ")or die(mysql_error()); echo "Member Added Inserted!.."; }