PHP - How To Color Label When Passing Value "0"
Hi,
in my code radio button disable when passing value is "0"
<script type="text/javascript"> $('input[type="radio"]').prop('disable', function() { return $(this).next().text().match(/\((\d+)\)/)[1] == 0; }); </script>it's ok.what i want to do is,color a label or label text when this function true. <label > <input type="radio" name="radio" id="rd" value="" /> Click </label>please help me Similar TutorialsHi All, I am currently using jpgraph on a site, and I'm trying to get the (x,y) coordinates an a chart to have two different colors ... (x = green, y = red) You can see an example he http://entropylinks.com/testgraph-dev.php?energy=2.2&entropy=1.75 Here is my code: Code: [Select] <?php // content="text/plain; charset=utf-8" require_once ("graph/src/jpgraph.php"); require_once ("graph/src/jpgraph_scatter.php"); DEFINE('MATRIX','images/matrix-big-2.png'); $datax = array(0,3); $datay = array(0,3); if(isset($_SESSION['counter']) && $_SESSION['counter'] > 1){ $x = 1.98; $y = 1.2; $count = $_SESSION['counter']; for($i = 0; $i < $count; $i++){ $datax[] += $_SESSION["entropy_$i"]; $datay[] += $_SESSION["energy_$i"]; } } else { $datax = explode('-', $_GET['energy']); $datay = explode('-', $_GET['entropy']); } $idx=0; function xyCallback($yval) { global $datay, $idx; return "($yval-".$datay[$idx++].")"; } $graph = new Graph(550,550); $graph->SetScale("intint",0,3,0,3); $graph->img->SetMargin(40,40,40,40); $graph->SetBackgroundImage(MATRIX,BGIMG_FILLPLOT); $graph->title->SetFont(FF_ARIAL,FS_BOLD); $graph->xaxis->SetTitle('CORPORATE ENTROPY','middle'); $graph->yaxis->SetTitle('CORPORATE ENERGY','middle'); $graph->yaxis->SetTextTickInterval(1,2); $sp1 = new ScatterPlot($datax,$datay); $sp1->mark->SetSize(10); $sp1->mark->SetFillColor("darkblue"); $sp1->mark->SetType(MARK_FILLEDCIRCLE); $sp1->value->SetMargin(17); $sp1->value->SetFormatCallback('xyCallback'); $sp1->value->SetColor("darkgreen"); $sp1->value->SetFont(FF_FONT0,FS_NORMAL); $sp1->value->Show(); $txt = new Text("Low"); // store text $txt->SetFont(FF_FONT0,FS_NORMAL); $txt->SetScalePos(0.5,0); $txt->SetColor('darkblue'); $txt->Center(50,150,75); $graph->AddText( $txt); // write to position $txt = new Text("Medium"); // store text $txt->SetFont(FF_FONT0,FS_NORMAL); $txt->SetScalePos(1.5,0); $txt->SetColor('darkblue'); $txt->Center(50,150,75); $graph->AddText( $txt); // write to position $txt = new Text("High"); // store text $txt->SetFont(FF_FONT0,FS_NORMAL); $txt->SetScalePos(2.5,0); $txt->SetColor('darkblue'); $txt->Center(50,150,75); $graph->AddText( $txt); // write to position $txt = new Text("Low"); // store text $txt->SetFont(FF_FONT0,FS_NORMAL); $txt->SetScalePos(-0.03,0.5); $txt->SetAngle(90); $txt->SetColor('darkblue'); $txt->Center(50,150,75); $graph->AddText( $txt); // write to position $txt = new Text("Medium"); // store text $txt->SetFont(FF_FONT0,FS_NORMAL); $txt->SetScalePos(-0.03,1.5); $txt->SetAngle(90); $txt->SetColor('darkblue'); $txt->Center(50,150,75); $graph->AddText( $txt); // write to position $txt = new Text("High"); // store text $txt->SetFont(FF_FONT0,FS_NORMAL); $txt->SetScalePos(-0.03,2.5); $txt->SetAngle(90); $txt->SetColor('darkblue'); $txt->Center(50,150,75); $graph->AddText( $txt); // write to position $graph->Add($sp1); $graph->Stroke(); ?> Here's the class code that controls the scatter graph Code: [Select] //=================================================== // CLASS ScatterPlot // Description: Render X and Y plots //=================================================== class ScatterPlot extends Plot { public $mark,$link; private $impuls = false; //--------------- // CONSTRUCTOR function __construct($datay,$datax=false) { if( (count($datax) != count($datay)) && is_array($datax)) { JpGraphError::RaiseL(20003);//("Scatterplot must have equal number of X and Y points."); } parent::__construct($datay,$datax); $this->mark = new PlotMark(); $this->mark->SetType(MARK_SQUARE); $this->mark->SetColor($this->color); $this->value->SetAlign('center','center'); $this->value->SetMargin(0); $this->link = new LineProperty(1,'black','solid'); $this->link->iShow = false; } //--------------- // PUBLIC METHODS function SetImpuls($f=true) { $this->impuls = $f; } function SetStem($f=true) { $this->impuls = $f; } // Combine the scatter plot points with a line function SetLinkPoints($aFlag=true,$aColor="black",$aWeight=1,$aStyle='solid') { $this->link->iShow = $aFlag; $this->link->iColor = $aColor; $this->link->iWeight = $aWeight; $this->link->iStyle = $aStyle; } function Stroke($img,$xscale,$yscale) { $ymin=$yscale->scale_abs[0]; if( $yscale->scale[0] < 0 ) $yzero=$yscale->Translate(0); else $yzero=$yscale->scale_abs[0]; $this->csimareas = ''; for( $i=0; $i<$this->numpoints; ++$i ) { // Skip null values if( $this->coords[0][$i]==='' || $this->coords[0][$i]==='-' || $this->coords[0][$i]==='x') continue; if( isset($this->coords[1]) ) $xt = $xscale->Translate($this->coords[1][$i]); else $xt = $xscale->Translate($i); $yt = $yscale->Translate($this->coords[0][$i]); if( $this->link->iShow && isset($yt_old) ) { $img->SetColor($this->link->iColor); $img->SetLineWeight($this->link->iWeight); $old = $img->SetLineStyle($this->link->iStyle); $img->StyleLine($xt_old,$yt_old,$xt,$yt); $img->SetLineStyle($old); } if( $this->impuls ) { $img->SetColor($this->color); $img->SetLineWeight($this->weight); $img->Line($xt,$yzero,$xt,$yt); } if( !empty($this->csimtargets[$i]) ) { if( !empty($this->csimwintargets[$i]) ) { $this->mark->SetCSIMTarget($this->csimtargets[$i],$this->csimwintargets[$i]); } else { $this->mark->SetCSIMTarget($this->csimtargets[$i]); } $this->mark->SetCSIMAlt($this->csimalts[$i]); } if( isset($this->coords[1]) ) { $this->mark->SetCSIMAltVal($this->coords[0][$i],$this->coords[1][$i]); } else { $this->mark->SetCSIMAltVal($this->coords[0][$i],$i); } $this->mark->Stroke($img,$xt,$yt); $this->csimareas .= $this->mark->GetCSIMAreas(); $this->value->Stroke($img,$this->coords[0][$i],$xt,$yt); $xt_old = $xt; $yt_old = $yt; } } // Framework function function Legend($aGraph) { if( $this->legend != "" ) { $aGraph->legend->Add($this->legend,$this->mark->fill_color,$this->mark,0, $this->legendcsimtarget,$this->legendcsimalt,$this->legendcsimwintarget); } } } // Class Does anyone have a solution for this? Is it even possible? Do I need to somehow modify the class to render these different colors? Feel free to ask any questions you may have, I'm 99% complete with this, but I just can't seem to change the colors of the plot labels. Thanks! Is it possible to have a link at the top of a page that has been displayed from a database? Just that some results show thousands of rows. Thanks.
Hi, I have a select menu like this: Code: [Select] <form id="form1" name="form1" method="post" action="<?php htmlentities($_SERVER['PHP_SELF']); ?>"> <table width="100%" border="0" align="center" cellpadding="2" cellspacing="0" > <tr> <td width="38" align="left" class="UsuarioNombreHeader"><label> <input name="CurrencyAmount" type="text" class="CP_ExchangeFormFields" id="CurrencyAmount" size="6" /> </label></td> <td width="11" align="left" nowrap="nowrap" class="personalTitulo">€</td> <td width="11" align="left" nowrap="nowrap" class="UsuarioNombreHeader">to</td> <td width="204" align="left" nowrap="nowrap" class="UsuarioNombreHeader"><select name="selectCurrencyTo" class="CP_loginFormFields" id="selectCurrencyTo"> <option value="value" >Select currency</option> <option value="<?php echo $row_currency_RS['AUD']; ?>" >Australia Dollar (AUD)</option> <option value="<?php echo $row_currency_RS['BRL']; ?>" >Brazil Real (BRL)</option> <option value="<?php echo $row_currency_RS['BGN']; ?>" >Bulgaria Lev (BGN)</option> <option value="<?php echo $row_currency_RS['CAD']; ?>" >Canada Dollar (CAD)</option> <option value="<?php echo $row_currency_RS['CNY']; ?>" >China Yuan Renminbi (CNY)</option> <option value="<?php echo $row_currency_RS['HRK']; ?>" >Croatia Kuna (HRK)</option> <option value="<?php echo $row_currency_RS['CZK']; ?>" >Czech Republic Koruna (CZK)</option> <option value="<?php echo $row_currency_RS['DKK']; ?>" >Denmark Krone (DKK)</option> <option value="<?php echo $row_currency_RS['HKD']; ?>" >Hong Kong Dollar (HKD)</option> <option value="<?php echo $row_currency_RS['HUF']; ?>" >Hungary Forint (HUF)</option> <option value="<?php echo $row_currency_RS['INR']; ?>" >India Rupee (INR)</option> <option value="<?php echo $row_currency_RS['IDR']; ?>" >Indonesia Rupiah (IDR)</option> <option value="<?php echo $row_currency_RS['ILS']; ?>" >Israel Shekel (ILS)</option> <option value="<?php echo $row_currency_RS['JPY']; ?>" >Japanese Yen (JPY)</option> <option value="<?php echo $row_currency_RS['KRW']; ?>" >Korea (South) Won (KRW)</option> <option value="<?php echo $row_currency_RS['LVL']; ?>" >Latvia Lat (LVL)</option> <option value="<?php echo $row_currency_RS['LTL']; ?>" >Lithuania Litas (LTL)</option> <option value="<?php echo $row_currency_RS['MYR']; ?>" >Malaysia Ringgit (MYR)</option> <option value="<?php echo $row_currency_RS['MXN']; ?>" >Mexico Peso (MXN)</option> <option value="<?php echo $row_currency_RS['NZD']; ?>" >New Zealand Dollar (NZD)</option> <option value="<?php echo $row_currency_RS['NOK']; ?>" >Norway Krone (NOK)</option> <option value="<?php echo $row_currency_RS['PHP']; ?>" >Philippines Peso (PHP)</option> <option value="<?php echo $row_currency_RS['PLN']; ?>" >Poland Zloty (PLN)</option> <option value="<?php echo $row_currency_RS['RON']; ?>" >Romania New Leu (RON)</option> <option value="<?php echo $row_currency_RS['RUB']; ?>" >Russia Ruble (RUB)</option> <option value="<?php echo $row_currency_RS['SGD']; ?>" >Singapore Dollar (SGD)</option> <option value="<?php echo $row_currency_RS['ZAR']; ?>" >South Africa Rand (ZAR)</option> <option value="<?php echo $row_currency_RS['SEK']; ?>" >Sweden Krona (SEK)</option> <option value="<?php echo $row_currency_RS['CHF']; ?>" >Switzerland Franc (CHF)</option> <option value="<?php echo $row_currency_RS['THB']; ?>" >Thailand Baht (THB)</option> <option value="<?php echo $row_currency_RS['TRY']; ?>" >Turkey Lira (TRY)</option> <option value="<?php echo $row_currency_RS['GBP']; ?>" >United Kingdom Pound (GBP)</option> <option value="<?php echo $row_currency_RS['USD']; ?>" >US Dollar (USD)</option> </select></td> <td width="58" align="left" nowrap="nowrap" class="UsuarioNombreHeader"><input type="submit" name="button" id="button" value="convert" /></td> <td width="38" align="left" nowrap="nowrap" class="UsuarioNombreHeader"><input name="CurrencyResult" type="text" class="CP_ExchangeFormFields" id="CurrencyResult" value="<?php echo $total_euros ?>" size="6" /></td> <td width="819" align="left" nowrap="nowrap" class="UsuarioNombreHeader"><?php echo $currency_amount?> € = <?php echo $total_euros?> <?php echo $select_currency?> </td> </tr> </table> </form>This is part of a currency conversion script I have done. Now I am outputting the result of the currency conversion like this: Code: [Select] <?php echo $currency_amount?> € = <?php echo $total_euros?> <?php echo HERE_I_WANT_THE_CURRENCY_NAME?>but because the select men labels are not dynamically pulled from my DB (due to the way the DB had to be done), I can't figure out how to echo the currency name at the end of the conversion result. Any ideas?...Thanks ok i think and hope this will be my last issue with this site. i have two forms on the same contact page, but right now theyre using the same error label. this means if ONE has an error, both forms show as that same error. id like to somehow separate this and give each one its own label. i tried doing like error[2] for the 2nd button instead of error[] but then i didnt know what to change the actual "error label" to. do i changed the "$errors = array();" part? to create a second label? i tried to google on it and couldnt figure it out. thanks a million to anyone who even reads <?php if (isset($errors)) { foreach ($errors as $error) { echo("<p>$error<p>\n"); } } ?> so my question basically is, how do i use this code below to create a second error case AND label please!! <?php if ($_POST['send']) { $errors = array(); if ($_POST['captcha'] != $_SESSION['captchacode']) { $errors[] = "You didn't enter the correct letters!"; } + <?php if (isset($errors)) { foreach ($errors as $error) { echo("<p>$error<p>\n"); } } ?> Hello. I have a basic form and I want to check for errors by making sure the user inputs everything, if not an error explaining to the user what needs to be fixed. (very common on all forms) When I use echo in my script, it displays at the top of my browser. How do I put the error codes right beside my form elements? I currently don't have all the error checking included but I want to get a few sorted out before anything else. Form Page: http://www.fusionfashionhair.com/registration.php My PHP Code all above DOCTYPE in the php file. Code: [Select] <?php $submit = $_POST['submit']; // Form Data // Check all form inputs using check_input function $name = strip_tags($_POST['name']); $address = strip_tags($_POST['address']); $email = strip_tags($_POST['email']); $repeatemail = strip_tags($_POST['repeatemail']); $phone = strip_tags($_POST['phone'], "Enter your Phone Number"); $salonname = strip_tags($_POST['salonname']); $salonaddress = strip_tags($_POST['salonaddress']); $salonprov = strip_tags($_POST['salonprov']); $salonpostal = strip_tags($_POST['salonpostal']); $salonconfirm = strip_tags($_POST['salonconfirm']); $enewsletter = strip_tags($_POST['enewsletter']); $saloncountry = strip_tags($_POST['saloncountry']); $password = strip_tags($_POST['password']); $repeatpassword = strip_tags($_POST['repeatpassword']); $date = date("Y-m-d"); // Set e-mail recipient $myemail = "info@fusionfashionhair.com"; if ($submit) { //check for existance if ($name&&$password&&$repeatpassword&&$email) { if ($password==$repeatpassword) { if ($email==$repeatemail) { //check password length if (strlen($password)>32||strlen($password)<6) { echo '<p class="formecho">Password must be between 6 and 32 characters</p>'; } else { // Thank you Page $insertGoTo = "thankyou.php"; header(sprintf("Location: %s", $insertGoTo)); // encrypt password $temppass = $password; $password = md5($password); $repeatpassword = md5($repeatpassword); // dBase file include "dbConfig.php"; //open database //generate random number for activation process $random = md5(rand(23456789,987654321)); // register the user! // Set default username $username = $email; // INSERT INTO user... replace user with table name // make sure you have the same number and order of values as the database has $queryreg = mysql_query(" INSERT INTO user VALUES ('','$name','$username','$password','$date','$email','$phone','$address','$salonname','$salonaddress','$salonprov','$salonpostal','$saloncountry','$salonconfirm','$enewsletter','$random','0')"); //Insert ID based on last ID in database $lastid = mysql_insert_id(); //send activation email $to = $email; $subject = "Activate Salon Member Acctount at Fusion Fashion Hair"; $headers = "From: webmaster@fusionfashionhair.com"; $server = "mail.fusionfashionhair.com"; //change php.ini and set SMTP to $server ini_set("SMTP",$server); $body = " $name from $salonname is wanting a membership, \n\n Please click on the link provided below to activate the account with Fusion Fashion Hair http://www.fusionfashionhair.com/activate.php?id=$lastid&code=$random \n\n Username = $username \n Password = $temppass \n Thank you, Customer Service "; //function to send email mail($to, $subject, $body, $headers); } } else echo '<p class="formecho">Your passwords do not match!</p>'; } else echo '<p class="formecho">Your Emails do not match!</p>'; }//End check Existance else echo '<p class="formecho">Please fill in <b>ALL</b> fields!</p>'; }// End if Sumbit ?> I'm not sure if this is the right section, if not, please move it on proper one, i'm still newbie. However, here's my problem, i'm using jquery to replace standard check boxes with images, and here's the code: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { /* see if anything is previously checked and reflect that in the view*/ $(".checklist input:checked").parent().addClass("selected"); /* handle the user selections */ $(".checklist .checkbox-select").click( function(event) { event.preventDefault(); $(this).parent().addClass("selected"); $(this).parent().find(":checkbox").attr("checked","checked"); } ); $(".checklist .checkbox-deselect").click( function(event) { event.preventDefault(); $(this).parent().removeClass("selected"); $(this).parent().find(":checkbox").removeAttr("checked"); } ); }); </script> Here's the css: <style type="text/css"> body { font: 12px/1.3 "Lucida Grande","Lucida","Arial",Sans-serif; } form { margin: 0 0 30px 0; } legend { font-size: 17px; } fieldset { border: 1; } .checklist { list-style: none; margin: 0; padding: 0; } .checklist li { float: left; margin-right: 10px; background: url(i/checkboxbg.gif) no-repeat 0 0; width: 105px; height: 80px; position: relative; font: normal 11px/1.3 "Lucida Grande","Lucida","Arial",Sans-serif; } .checklist li.selected { background-position: -105px 0; } .checklist li.selected .checkbox-select { display: none; } .checkbox-select { display: block; float: left; position: absolute; top: 55px; left: 10px; width: 85px; height: 23px; background: url(i/select.gif) no-repeat 0 0; text-indent: -9999px; } .checklist li input { display: none; } a.checkbox-deselect { display: none; color: white; font-weight: bold; text-decoration: none; position: absolute; top: 55px; right: 10px; } .checklist li.selected a.checkbox-deselect { display: block; } .checklist li label { display: block; text-align: center; padding: 8px; } .sendit { display: block; float: left; top: 118px; left: 10px; width: 115px; height: 34px; border: 0; cursor: pointer; background: url(i/sendit.gif) no-repeat 0 0; text-indent: -9999px; margin: 20px 0; } </style> And finally the form thing <ul class="checklist"><li><input name="jqdemo" value="value5" type="checkbox" id="choice_c"/><label for="choice_c">Some Text Here to be checked - clicked</label><a class="checkbox-select" href="#">Click</a><a class="checkbox-deselect" href="#">Cancel</a></li></ul> I would like that my text on top of checkboxes become clickable. Code: [Select] <?php $parentesco .=' <ul><li><a href="children.php?category_id='.$idc.'&name= '. $name2 . '">'. $name. ' </a></li></ul>'; ?> in the url string $idc is passing but $name2 is not. $name2 is pickup from a query, I echo that value everywhere in the code and it echo its value but is not passing so how. Help I have some function or method. Is there a better design patter to implement this?
function myFunction($a=null,$b=null,$c=null,$d=null,$e=null,$f=null,$g=null,$h=null) { //Do a bunch of stuff }Maybe the second function? function myNewFunction($data=array()) { $data=array_merge(array('a'=>null,'b'=>null,'c'=>null,'d'=>null,'e'=>null,'f'=>null,'g'=>null,'h'=>null),$array); //Do a bunch of stuff }Please provide decision making factors why you would use one approach over the other. Hello everyone! I need a little help to get functions names from the GD library. first i want to say i have a little knowledge with GD library like create image with words and etc. So , what i'm trying to do is to take image and than take the color of the first pixel on the top left than do some function work and than set this pixel on the top left to another color. now , i know how the algorithm should look like , i just don't know what function i need to use to: take specific pixel color from the image set new color for pixel on specific place i'll be glad if you could help me with that , regards , Mor. Ok quick run down... I need to pass a variable from one page[form] to another while skipping a page that is in the middle. The middle page is paypal... after they pay, they are being redirected to a thank you for registering with a email also being sent. But I need their email from the first page[form]. so what i need to figure out or help is: 1. First page is a form, they enter name, last name, address, email and so on 2. They are redirected to paypal to pay for a service. 3. Are directed back to my site for a email to be sent to them, but I need their email from the first page. //i've been looking at this same code for two whole days now and ive changed it lots of times but it can only get worse //i can't pass the value of the variable $today which has a date datatype //this is the part where i get the value of $today <?php $query="SELECT DISTINCT today FROM arrastre order by today desc"; $result=mysql_query($query); while($row=mysql_fetch_object($result)){ $today=$row->today; echo "<option value=$today>$today</option>"; } ?> //here's is the part where i use $today to get $tcl //except for a major problem that when the while loop returns more than one $tcl, i get more than one button, but that's not the problem because that is how it's supposed to work. The problem is that when there are more than one buttons, only the last button would work, the only button that displays values <?php if(isset($_POST['godate'])){ $today=$_POST['today']; $query="SELECT DISTINCT tcl FROM arrastre WHERE today='$today' ORDER BY tcl ASC"; $result=mysql_query($query); while($row=mysql_fetch_array($result)){ $tcl=$row['tcl']; $today=$row['today']; ?> <input type="hidden" name="tcl" value="<?php echo $tcl;?>"> <input type=submit name="tcl" value="<?php echo $tcl; ?>"> <?php } } ?> //thsi is another problem if(isset($_POST['tcl'])){ $tcl=$_POST['tcl']; $today=$_POST['today']; $query = "select * from arrastre where tcl=$tcl and today='$today' order by tcl asc"; $result = mysql_query($query); $totalcollections = 0; while($row=mysql_fetch_array($result)){ $orno=$row['orno']; $billnmbr=$row['billnmbr']; $payor=$row['payor']; $arrastre=$row['arrastre']; $wharfage=$row['wharfage']; $total=$row['total']; $today=$row['today']; //*i deleted the display part to make this shorter a little }} //the $today variable is empty in this post and i have no idea how to successfully pass this value so i could use it in my $query //thanks for your time hai everybody....
1. can any one let me know how to pass a variable from view to controller in CodeIgniter...
2. if possible send me a complete login application...developed by using CodeIgniter....
Thanks & Regards,
Shankaar.
I cannot figure this out and I know I'm just looking past the obvious... I am creating a simple "you are now leaving this website" page, Everything is setup, and all urls pointing to http://mysite.com?exit=http://externalsite.com, It should redirect to my exit.php which will redirect to the external site after 5 seconds. The problem is, the "http://" of the external site is causing a 403 forbidden, and even without it, anything with multiple &s isn't passing through. I cannot figure out how to get it to pass the full url to the exit.php... This is driving me MAD! The Variable gets passed through the URL but when I try and echo the result I gte NOTHING. First Page. Code: [Select] <?php include'config.php'; $result = mysql_query("SELECT * FROM carbontrust"); while($entry = mysql_fetch_array($result)) Print "$entry[contact] - $entry[company] :: <a href='edit.php?id=$entry[id]'>Edit</a><br>"; exit; ?> Second Page. (Where I want the Variable passed to) Code: [Select] <?php include'config.php'; $id = $_GET['id']; echo "ID: $id"; } ?> Its probably just a stupid error but iv looked through a load of tutorials and this should be correct. :/ Trying to set up an error message when someone tries to upload a file without the approved .ext. I have it working so it won't up load but I am trying to get an error to print out. I was thinking that I could do something like this if the ext are wrong set $errorMsg1 == 1; and then the page will refresh and I would pass that variable to echo out if ($errorMsg1 == 1){ echo "Invalid"; } else { but it isn't passing can anyone help me with this? Tyring to keep it simple this is the code to select an image else{ $result = mysql_query("SELECT * FROM photos WHERE userID LIKE '$clientID'"); while ($r=mysql_fetch_array($result)) { $photo_1=$r['photo_1']; $photo_2=$r['photo_2']; $photo_3=$r['photo_3']; $photo_4=$r['photo_4']; $photo_5=$r['photo_5']; echo " <form enctype='multipart/form-data' action='' method='POST'> <input type='hidden' name='MAX_FILE_SIZE' value='500000' /> <div id='imageTop'>Image &#35;1</div> "; if ($errorMsg1 == 1){ echo "Invalid"; } echo " <div id='imageBottom'> <span class='image'>"; if (empty($photo_1)) { echo " <img src='uploads/noPhoto.gif' width='75' height='75' class='zip'> "; } else { echo "<a href='uploads/$photo_1' ><img src='uploads/$photo_1' width='75' height='75' class='zip'></a> "; } echo " </span> <span class='action'> <input type='file' name='photo_1' class='zip'><br><br> <input type='checkbox' name='delete_1'>Select to Delete image </span> </div> } this is the code of what to do with that image if (isset($_POST['delete_1'])) { $query = "UPDATE photos SET photo_1='' WHERE userID='$clientID'"; $result = mysql_query($query) or die(mysql_error()); echo " <div id='aboutUpdate'><img src='img/loader.gif'> Information is updating</div> "; echo "<meta http-equiv=refresh content=\"0; URL=photos.php\">"; } else if ($one != NULL) { $extension = strrchr($_FILES['photo_1']['name'],'.'); $extension = strtolower($extension); if($extension != '.jpg' && $extension != '.gif' && $extension != '.png' && $extension != '.bmp' ){ $errorMsg1 == 1; echo "<meta http-equiv=refresh content=\"0; URL=photos.php\">"; } else { $photoNumber="_1"; $finalName="$clientID$photoNumber"; $save_path = "uploads/"; $target_path = $save_path . basename( $_FILES['photo_1']['name']); $NewPhotoName = $finalName; $withExt = $NewPhotoName . $extension; $filename = $save_path . $NewPhotoName . $extension; if(move_uploaded_file($_FILES['photo_1']['tmp_name'], $filename)) { $query = "UPDATE photos SET photo_1='$withExt' WHERE userID='$clientID'"; $result = mysql_query($query) or die(mysql_error()); echo " <div id='aboutUpdate'><img src='img/loader.gif'> Information is updating</div> "; echo "<meta http-equiv=refresh content=\"0; URL=photos.php\">"; } } else { Hi, im trying to pass the information of a specific data to be edited in another form which is edit_doc.php. However, when i click "Edit" it doesnt seem to work. Only edit_doc.php opens but the information the does not appear. Is ther any mistake in the codes? while ($rows = mysql_fetch_assoc($run)) { echo"<tr>"; echo "<td>". $rows['file_ref'] ."</td>"; echo "<td>". $rows['file_name'] ."</td>"; echo "<td>". $rows['owner'] ."</td>"; echo "<td>". $rows['url'] ."</td>"; echo "<td><a href=edit_doc.php?id=$rows>" . "Edit" . "</a></td>"; echo "<td><a href=delete.php?id=$rows>" . "Delete" . "</a></td>"; echo "</tr>"; } echo "</table>"; } Thankz Hello all, So I've picked up a PHP book in an attempt to learn it. The issue I'm having is preventing me from getting any further. They have me creating a simple order form, but the data is not passing from the HTML page to the PHP Processing file. I know there are other ways of doing this that I'm unaware of, but this code is verbatam to what we are isntructed to type within the book itself. Here is the code orderform.html: Code: [Select] <html> <body> <form action="processorder.php" method="post"> <table border="0"> <tr bgcolor="#cccccc"> <td width="150">Item</td> <td width="15">Quantity</td> </tr> <tr> <td>Tires</td> <td align="center"><input type="text" name="tireqty" size="3" maxlength="3"></td> </tr> <tr> <td>Oil</td> <td align="center"><input type="text" name="oilqty" size="3" maxlength="3"></td> </tr> <tr> <td>Spark Plugs</td> <td align="center"><input type="text" name="sparkqty" size="3" maxlength="3"></td> </tr> <tr> <td>How did you find Bob's?</td> <td><select name="find"> <option value = "a">I'm a regular customer</option> <option value = "b">TV advertising</option> <option value = "c">Phone directory</option> <option value = "d">Word of mouth</option> </select> </td> </tr> <tr> <td colspan="2" align="center"><input type="submit" value="Submit Order"></td> </tr> </table> </form> </body> </html> processorder.php: <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Bobs Auto Parts - Order Results</title> </head> <body> <h1>Bobs Auto Parts</h1> <h2>Order Results</h2> <?php $tireqty = $_post['tireqty']; $oilqty = $_post['oilqty']; $sparkqty = $_post['sparkqty']; echo "<p>Order Processed at "; echo date('H:i, jS F Y'); echo "</p>"; echo '<p>Your order is as follows: </p>'; echo $tireqty.' tires<br />'; echo $oilqty.' bottles of oil<br />'; echo $sparkqty.' spark plugs<br />'; $totalqty = 0; $totalamount = 0.00; define('TIREPRICE', 100); define('OILPRICE', 10); define('SPARKPRICE', 4); ?> </body> </html> For some reason the values on the processing form dont show up. The only text thats displayed is : Bobs Auto Parts Order Results Order Processed at 17:07, 9th January 2011 Your order is as follows: tires <---- Should be showing the total quantity ordered bottles of oil <---- Should be showing the total quantity ordered spark plugs <---- Should be showing the total quantity ordered Is anyone able to let me know where the error is in this code? The writers website isnt any help.... Regards, sapper6fd hello all, I'm new here and I'm learning mysql/php. Currently I have a dynamic table on one of my webpages, and the loop code looks like this:while ($i < $numRows) { $fname = mysql_result($result, $i, "fname"); $fcode = mysql_result($result, $i, "fcode"); $ftype = mysql_result($result, $i, "ftype"); $fdesc = mysql_result($result, $i, "fdesc"); ?> <tr> <td><a href="showfunction.php?fname=<?php echo "$fname"; ?>" target="_self"> <?php echo "$fname"; ?></a></td> <td> <?php echo "$fdesc"; ?> </td> <td><div align="center"> <?php echo "$ftype"; ?> </div></td> </tr> <?php $i++; } ?> what I would like to do is pass the ''fname'' variable to the "showfunction" page so it can printed from the database. Here is the relevant portion of the page:<body><div class="codeblock"> <div class="title">Code:<br /> </div><code><pre> <?php echo $fcode; ?> </pre></code></div> <br /><pre><hr /> </pre> I know that doesn't work, and I didn't expect it to because there is no way to 'get' the 'fname' variable from the preceeding script. I do not want to use the GET method with this because from what I understand, you can only use it with Forms. I really don't want to put controls in all of my table fields just to be able to pass the function name to the next page. Does that make sense? If I could get a jumpstart on this one last hurdle, I would appreciate it. thank you so much! Cheers. I'm creating this URL to pass variables to use from one Page to another:
http://eg10basketbal...Borgman&team=16
My WP site is seeing the first variable but not the second. After some searching I've found this suggestion, but it's not working for me:
function add_query_vars_filter( $vars ) { $vars[] = "nameFull"; $vars[] = "team"; return $vars; } add_filter( 'query_vars', 'add_query_vars_filter' );I tried putting this in the wp-includes/functions.php file of the, but ended up with a fatal error. I have since added it to my theme's functions.php file. There isn't an error, but it doesn't yield recognition of my second variable. Hi First post here. Long time reader! I'm looking to gauge the general practices of dealing with variables between pages. I'd always pass my variables through the POST. Im normally always doing a post back and processing the data at the top of the page. I never liked the query string as it open to manipulation, but can see its use for a search results page and saving the url. I came from a ASP background and we would only use session variables for holding user login information as the windows server had a habit of restarting the pool and loosing the session. We didn't want this happening, for example, when doing an e-commerce transaction. We always felt the post was the most robust method. Now Im using php and all the great features it has. I was looking to see what the more experience php developers used and am I right sticking to the post method, or is utilising session a more modern way of doing things. I've a few years experience doing web dev, just thought I touch base on a few issues to make sure I'm still heading in the right direction. Thanks for any advice guys! |