Jump to content

madcrazy1

Members
  • Posts

    48
  • Joined

  • Last visited

    Never

Posts posted by madcrazy1

  1.  

    I need code to throw validate flag only if no fields are filled

    Current code below throws validate flag if any field is empty. Many thanks!

    (a flag has a background of error.png

    no flag has a background of checked.png)

     

    	validates errors on all the fieldsets
    records if the Form has errors in $('#formElem').data()
    */
    function validateSteps(){
    	var FormErrors = false;
    	for(var i = 1; i < fieldsetCount; ++i){
    		var error = validateStep(i);
    		if(error == -1)
    			FormErrors = true;
    	}
    	$('#formElem').data('errors',FormErrors);	
    }
    
    /*
    validates one fieldset
    and returns -1 if errors found, or 1 if not
    */
    function validateStep(step){
    	if(step == fieldsetCount) return;
    
    	var error = 1;
    	var hasError = false;
    	$('#formElem').children(':nth-child('+ parseInt(step) +')').find(':input:not(button)').each(function(){
    		var $this 		= $(this);
    		var valueLength = jQuery.trim($this.val()).length;
    
    		if(valueLength == ''){
    			hasError = true;
    			$this.css('background-color','#FFEDEF');
    		}
    		else
    			$this.css('background-color','#FFFFFF');	
    	});
    	var $link = $('#navigation li:nth-child(' + parseInt(step) + ') a');
    	$link.parent().find('.error,.checked').remove();
    
    	var valclass = 'checked';
    	if(hasError){
    		error = 1;
    		valclass = 'error';
    	}
    	$('<span class="'+valclass+'"></span>').insertAfter($link);
    
    	return error;
    }
    
    /*
    
    });

  2. <?php
    $var=$_POST["fname"];            
    $xmlDoc = new DOMDocument();
    $xmlDoc->loadXML($var);
    
    $root = $xmlDoc->documentElement;              
    $elms = $root->getElementsByTagName("*");      
    
    
    foreach ($elms as $item) {
      // gets the name and the value of each $item
      $tag = $item->nodeName;
      $value = $item->nodeValue;
    
      // outputs the $tag and $value
      echo $tag. ' = '. $value . '';
    
    

     

    I want to use the code above to get all the xml files parent and child names and values

    and get them into the database. is this going to work?

    thanks in advance

  3. this is what i have so far:

     

    $var=$_POST["fname"];
    $xmlDoc = new DOMDocument();
    $xmlDoc->loadXML($var);
    

     

     

    I would like to use something similar to this included in it before sql insert:

    for($c = 0; $c<$node->length; $c++) 
    {	
    

     

     

    1 root, 4 parents and varying childs I believe?

    <node>
    
    <building>Number 65</building>
    
    <workers><label>executive</label><names>john</names><label>cook</label><names>terry</names><label>waitress</label><names>jill</names><label>buser</label><names>4564646</names><label>Main</label><number>45564646</number><label>home fax</label><number>45964646</number></workers>
    
    
    <food><label>breakfast</label><meal>eggs</meal><label>lunch</label><meal>turkey</meal><label>dinner</label><meal>steak</meal></food>
    
    
    <addresses><label>Home</label><Country>usa</Country><Street>123 mulberry ln </Street><ZIP>57888</ZIP><City>teledo</City><State>Ohio</State><label>location</label><Street>turnpike east 23</Street><City>danbury</City><State>Connecticut</State><Country>USA</Country></addresses>
    
    <building>Number 66</building> etc...
    
    </node>
    
    

     

    Thank you!

  4. I have a table with a row for name and a row for number. Specific number belongs to specific name (eg.. telephone number)

    I have table set for utf8_general_ci

    I have a primary key auto_increment=1

    I define two rows as UNIQUE name,number

    data is inserted FROM XML node

    The trouble is that after insert, I see all names and numbers inserted except that the numbers were inserted sequentially (values low to high) with respect to the primary key's values (low to high) erroneously mixing the name, number pairs. Any ideas? I need the data inserted in "document form" (order as they are reported/sent to query) Thank you.

  5.  

    I would like it to work this way if possible. All ive been getting is blank db entries, ive eliminated the rand til i can get this to work, is this possible?

    i had a hard time trying to integrate/format into existing code the $tryingName example you gave before.

     

    $l1="larry";
    
    $RunThisQuery = "SELECT namx FROM mytable WHERE namx='$l1'";
    $result = $connector->query($RunThisQuery);
    $bbb=$row['memn'];
    
    if($bbb==$l1){
    $name = "fromdb";
    }else{
    $name = $l1;
    }

     

     

  6. well i just saw your post, thanks for the quick reply but i was trying to get this to work, if not i will try your way:

     

    
    $p7=$userinput;
    $ID = mysql_query("SELECT pid FROM ".$users6." WHERE row_namex = '$p7' ");
    if ($ID){
    $name = $p7.rand(0,9);
    }else{
    $name = $p7;
    }

     

    everything seems to be working except when i try to add the same name twice, it doesnt put the random number next to($p7) it, is that strange?

  7. Sorry, actually, i do like the first answer very much, it took a couple looks at it to decifer it but i will like to add the random function that answer 2 has instead of arbitrary "suffix" good work! Will now try to implement and report back with result

  8. Sorry, I don't like the first answer, it is too abstract for me.

    Thwswcond answeris a bit closer to what i'm looking for but i am not sure what is meant by "unique index" if anything I want the code executed on non-uniqueness

    all in all thanks for the help but other solutions or additions to existing are welcome :rtfm:

     

  9. php5.2, mysql server5.02: if record exists,append random digit to end of information in rows column then add to database

     

    If user mike already exists and another mike is trying to create a user id

    I would like to keep the old mike record like it is, then add a new mike record, but add a unique digit to the end of the name mike before the record gets added to the database as a new row.

     

    Thank you kindly!

  10. PHP Version 5.2.2

    Server version: 5.0.67

    MySQL client version: 5.0.67

     

    I have code below that works well, but now i want to exclude the output values of query "tid" from table "tbl_names" where a match is found in a column called "tid" in another table "tbl_exclude"

    in other words, when the check boxes are created only the values that do not match

    show.  can this be done? if so please include full code and i will try it and anounce result. Thank you.

     

    $quer2=mysql_query("SELECT DISTINCT tid, LEFT(memn,7) AS SHORT_DESC FROM tbl_names where userid=$id order by tbl_names.memn ASC LIMIT 100");

     

    while($noticia2 = mysql_fetch_array($quer2)) {

    if($noticia2['tid']==@$id){echo "<td><input name='l2[]' type='checkbox' id='l2[]' value='$noticia2[tid]'> $noticia2[sHORT_DESC]..<br/></td>";}

    else{echo "<td><input name='l2[]' type='checkbox' id='l2[]' value='$noticia2[tid]'> $noticia2[sHORT_DESC]..<br/></td>";}

  11. My onpage items freeze or stop when used with this snow falling javascript effect.

     

    What can i add to the code to make it stop interfering with onpage stuff like gifs and marquees?

     

    Thank you here is code,

     

    N = 300; 
    Y = new Array();
    X = new Array();
    S = new Array();
    A = new Array();
    B = new Array();
    M = new Array();
    V = (document.layers)?1:0;
    
    iH=(document.layers)?window.innerHeight:window.document.body.clientHeight;
    iW=(document.layers)?window.innerWidth:window.document.body.clientWidth;
    for (i=0; i < N; i++){                                                                
    Y[i]=Math.round(Math.random()*iH);
    X[i]=Math.round(Math.random()*iW);
    S[i]=Math.round(Math.random()*5+2);
    A[i]=0;
    B[i]=Math.random()*0.1+0.1;
    M[i]=Math.round(Math.random()*1+1);
    }
    if (V){
    for (i = 0; i < N; i++)
    {document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0 BGCOLOR='#FFFFF0' CLIP='0,0,"+M[i]+","+M[i]+"'></LAYER>")}
    }
    else{
    document.write('<div style="position:absolute;top:0px;left:0px">');
    document.write('<div style="position:relative">');
    for (i = 0; i < N; i++)
    {document.write('<div id="si" style="position:absolute;top:0;left:0;width:'+M[i]+';height:'+M[i]+';background:#fffff0;font-size:'+M[i]+'"></div>')}
    document.write('</div></div>');
    }
    function fall(){
    var H=(document.layers)?window.innerHeight:window.document.body.clientHeight;
    var W=(document.layers)?window.innerWidth:window.document.body.clientWidth;
    var T=(document.layers)?window.pageYOffset:document.body.scrollTop;
    var L=(document.layers)?window.pageXOffset:document.body.scrollLeft;
    for (i=0; i < N; i++){
    sy=S[i]*Math.sin(90*Math.PI/180);
    sx=S[i]*Math.cos(A[i]);
    Y[i]+=sy;
    X[i]+=sx; 
    if (Y[i] > H){
    Y[i]=-10;
    X[i]=Math.round(Math.random()*W);
    M[i]=Math.round(Math.random()*1+1);
    S[i]=Math.round(Math.random()*5+2);
    }
    if (V){document.layers['sn'+i].left=X[i];document.layers['sn'+i].top=Y[i]+T}
    else{si[i].style.pixelLeft=X[i];si[i].style.pixelTop=Y[i]+T} 
    A[i]+=B[i];
    }
    setTimeout('fall()',10); 
    }

     

     

  12. This is as far as i got, but it's not working:

    <?
    if($_POST['Submit']){
    
    $subject = $_REQUEST["subject"];
    $message = $_REQUEST["message"];
    $from = $_REQUEST["from"];
    $verif_box = $_REQUEST["verif_box"];
    
    // remove the backslashes that normally appears when entering " or '
    $message = stripslashes($message); 
    $subject = stripslashes($subject); 
    $from = stripslashes($from); 
    
    if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
    // if verification code was correct send the message and show this page
    mail("$ID", 'Online Form: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$message, "From: $from");
    // delete the cookie so it cannot sent again by refreshing this page
    setcookie('tntcon','');
    } else {
    // if verification code was incorrect then return to contact page and show error
    header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&wrong_code=true");
    exit;
    }}
    ?>
    
    
    <center><font size="+1"><b>Contact Form</b></font></center>
    <br>
    <table align="center"><tr><td class="post_comments"><b>
    
    <form action="<? echo $PHP_SELF; ?>" method="post" name="form1" id="form1" style="margin:0px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:13px; width:300px;" onsubmit="MM_validateForm('from','','RisEmail','subject','','R','verif_box','','R','message','','R');return document.MM_returnValue">
    
    Your e-mail:<br />
    <input name="from" type="text" id="from" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:20px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:13px;" value="<?php echo $_GET['from'];?>"/>
    <br />
    
    Subject:<br />
    <input name="subject" type="text" id="subject" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:20px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px;" value="<?php echo $_GET['subject'];?>"/>
    <br />
    
    Type the 4 Digits Shown:
    <input name="verif_box" type="text" id="verif_box" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:20px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px;"/>
    <img src="http://www.bizpup.com/contact/verificationimage.php?<?php echo rand(0,9999);?>" alt="verification image, type it in the box" width="75" height="50" align="center" /><br />
    
    <!-- if the variable "wrong_code" is sent from previous page then display the error field -->
    <?php if(isset($_GET['wrong_code'])){?>
    <div style="border:1px solid #990000; background-color:#D70000; color:#FFFFFF; padding:4px; padding-left:6px;width:295px;">Wrong verification code</div><br /> 
    <?php ;}?>
    
    Message:<br />
    <textarea name="message" cols="6" rows="5" id="message" style="padding:2px; border:1px solid #CCCCCC; width:300px; height:100px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px;"><?php echo $_GET['message'];?></textarea>
    
    <input name="Submit" type="submit" style="margin-top:10px; display:block; border:1px solid #000000; width:100px; height:20px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; padding-left:2px; padding-right:2px; padding-top:0px; padding-bottom:2px; line-height:14px; background-color:#EFEFEF;" value="Send Message"/>
    </form>
    </font></td></tr></table>
    <br/>
    </b></font>
    
    </body>
    </html>
    

  13. what is the proper formatting/syntax to add this code into the script at the bottom

    so that when the form is submitted it will execute this new new code via the form action=<? echo $PHP_SELF; ?> command.

    code to add to bottom script and execute on form action command:

    $subject = $_REQUEST["subject"];
    $message = $_REQUEST["message"];
    $from = $_REQUEST["from"];
    $verif_box = $_REQUEST["verif_box"];
    $message = stripslashes($message); 
    $subject = stripslashes($subject); 
    $from = stripslashes($from); 
    
    mail("$ID", 'Online Form: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$message, "From: $from");
    	exit;
    }

     

     

     

     

    <form action="<? echo $PHP_SELF; ?>" method="post" name="form1" id="form1">
    
    Your e-mail:<br />
    <input name="from" type="text" id="from"  value="<?php echo $_GET['from'];?>"/>
    <br />
    
    Subject:<br />
    <input name="subject" type="text" id="subject" value="<?php echo $_GET['subject'];?>"/>
    <br />
    
    Message:<br />
    <textarea name="message" cols="6" rows="5" id="message"><?php echo $_GET['message'];?></textarea>
    
    <input name="Submit" type="submit"  value="Send Message"/>
    </form>
    </td></tr></table>
    

     

    Thanks for the help

  14. 
    <form id="form1" name="form1" method="post" action="memyselfandI">
    <input name="" type="hidden" id="question1">
    <select name="question1" >
    <option value="ans1">MYANSWERIS1</option>
    <option value="ans2">MYANSWERIS2</option>
    
    <input name="" type="hidden" id="question2">
    <select name="question2" >
    <option value="ans1">MYANSWERIS1</option>
    <option value="ans2">MYANSWERIS2</option>
    <input type="submit" name="Submit" value="*Submit Changes*"></form>
    

     

    I only want to select first question and have question2 get automatically selected with the same answer =)

  15. 2 form fields: send same answer value to 2 different rows but with only manually selecting the first form fileld choice. whatever I pick for the first question will automatically be populated as an answer for the second question filed. example i select answer 10 from drop down form field 1 and "before I click submit" ---- answer 10 is selected automatically for drop down menu choice 2

     

    in other words, there are 2 choices to MAKE ON A FORM i CREATED.

     

    i want to be able to select an answer for the first question have it sent to "sql row1"= ans1 then have the second question that uses a different input variable, use the same answer but send it to "sql row2"= ans1

     

    Please help, i will be a miracle if someone understands this

  16. Strange thing occurs:

    if i upload 2 apple pics

    the code below outputs both pics twice , so i get an original 2 then a duplicate

    2

     

    if i upload 3 apple pics the code outputs 9! two duplicates

     

    THIS DOSENT HAPPEN IF I ONLY UPLOAD 1 PIC, IT  DOSENT ECHO IT TWICE SO TO SPEAK

    please help

     

    there is only 5 fruits in the row called 'make'

     

     

     

     

     

     

     

    <?
    $RunThisQuery = "SELECT * FROM frm_photos WHERE userid=".$_REQUEST['id'];
    	$results = $connector->query($RunThisQuery);
    while ($row = $connector->fetchArray($results)){
    		$make1= $row['make'];
    
    
    
    ?>
      <? if($make1 =='apples'){ ?>
    <br>
    <img src='/images/picbox/apples.gif' border='0' style="margin-left:25px;"><a name='22'></a><br>
    <table width="100%" cellspacing="2" cellpadding="2" style="margin-left:18px;">
            <tr> 
              <td><? print $Blog3; ?></td>
            </tr>
            <tr> 
                    <?
    $PIC_LINK = Q("SELECT sValue AS result FROM frm_settings WHERE sid =16",$connector);
    	$RunThisQuery ="SELECT * FROM frm_photos WHERE userid=".$_REQUEST['id']." and frm_photos.make='apples' ORDER BY frm_photos.default DESC ";
    	$result = $connector->query($RunThisQuery);
    	$num_got = $connector->fetchNumResult($result);	
    	if ($num_got > 0){		
    		 while ($row = $connector->fetchArray($result)){  
    		 $img_alt = substr($row['title'], 0, 50);
    
    	$box1 = "<table cellpadding='0' cellspacing='0' border='0' width='100%'>
            <tr> 
              <td align='center' height='100'> <table cellpadding='0' cellspacing='0' border='0' bgcolor='#000000'>
                  <tr> 
                    <td> <table width='100%' cellpadding='0' cellspacing='0' border='0' class=''>
                        <tr> 
                          <td><a href='/ac/i2_index.php?page=preview&photo_id=".$row['id']."&image=".$row['bigimage']."'><img border='3' src='".$PIC_LINK.$row['bigimage']."' alt='".$row['title']."'></a></td>
                        </tr>
                      </table>
    
    
    </td>
                  </tr>
                </table></td>
            </tr>
          </table>
    <table width='160' align='center' cellpadding='0' cellspacing='0' bordercolor='#ffffff'>
      <tr> 
              <td> <table width='100%' border='0' cellpadding='0' cellspacing='1' bordercolor='#ffffff' bgcolor='#FFFFFF'>
            <tr bgcolor='#000000'> 
              <td align='center'><a href='/ac/i2_index.php?page=preview&photo_id=".$row['id']."&image=".$row['bigimage']."'><font color='#FFFFFF' size='2'><crisp>".$img_alt."..</crisp></font></a>
    </td></tr></td></tr></table></td></tr></table><br><br>";
    
    
    			if($boxrow%3){print "<td>".$box1."</td>";}else{print "<td>".$box1."</td></tr>";}
    			$boxrow++;
    ?>
    		<? } } ?> <br></td>
            </tr>
            <tr> 
              <td height="20"> </td>
            </tr>
          </table>
    <? } ?> <? if($make1 =='peaches'){ ?>
    <br>
    <img src='/images/picbox/peaches.gif' border='0' style="margin-left:25px;"><a name='22'></a><br>
    <table width="100%" cellspacing="2" cellpadding="2" style="margin-left:18px;">
            <tr> 
              <td><? print $Blog3; ?></td>
            </tr>
            <tr> 
                    <?
    $PIC_LINK = Q("SELECT sValue AS result FROM frm_settings WHERE sid =16",$connector);
    	$RunThisQuery ="SELECT * FROM frm_photos WHERE userid=".$_REQUEST['id']." and frm_photos.make='peaches' ORDER BY frm_photos.default DESC ";
    	$result = $connector->query($RunThisQuery);
    	$num_got = $connector->fetchNumResult($result);	
    	if ($num_got > 0){		
    		 while ($row = $connector->fetchArray($result)){  
    		 $img_alt = substr($row['title'], 0, 50);
    
    	$box1 = "<table cellpadding='0' cellspacing='0' border='0' width='100%'>
            <tr> 
              <td align='center' height='100'> <table cellpadding='0' cellspacing='0' border='0' bgcolor='#000000'>
                  <tr> 
                    <td> <table width='100%' cellpadding='0' cellspacing='0' border='0' class=''>
                        <tr> 
                          <td><a href='/ac/i2_index.php?page=preview&photo_id=".$row['id']."&image=".$row['bigimage']."'><img border='3' src='".$PIC_LINK.$row['bigimage']."' alt='".$row['title']."'></a></td>
                        </tr>
                      </table>
    
    
    </td>
                  </tr>
                </table></td>
            </tr>
          </table>
    <table width='160' align='center' cellpadding='0' cellspacing='0' bordercolor='#ffffff'>
      <tr> 
              <td> <table width='100%' border='0' cellpadding='0' cellspacing='1' bordercolor='#ffffff' bgcolor='#FFFFFF'>
            <tr bgcolor='#000000'> 
              <td align='center'><a href='/ac/i2_index.php?page=preview&photo_id=".$row['id']."&image=".$row['bigimage']."'><font color='#FFFFFF' size='2'><crisp>".$img_alt."..</crisp></font></a>
    </td></tr></td></tr></table></td></tr></table><br><br>";
    
    
    			if($boxrow%3){print "<td>".$box1."</td>";}else{print "<td>".$box1."</td></tr>";}
    			$boxrow++;
    ?>
    		<? } } ?> <br></td>
            </tr>
            <tr> 
              <td height="20"> </td>
            </tr>
          </table>
    <? } ?>

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.