patk570 42 Newbie Poster

So now I have another issue. When I do a search with multiple terms like Neck and Trapezius i get this: http://www.patrickspcrepair.com/images/2-search.PNG which is not everything, but when i do just trapezius on its own, i get: http://www.patrickspcrepair.com/images/1-search.PNG.

patk570 42 Newbie Poster

So i ammended the code to reflect this:

if($row_num_links_main < 1){
    $query = "SELECT * FROM libvid WHERE FIND_IN_SET(%$trimm%) ORDER BY id ASC";
    $numresults=mysql_query ($query);
    $row_num_links_main1 = mysql_num_rows($numresults);

but it will not execute query. did i do it right?

patk570 42 Newbie Poster

Now I do have this search string in my code as well:

$query = "SELECT * , MATCH (title, catagories) AGAINST ('".$trimm."') AS score FROM libvid WHERE MATCH (title, catagories) AGAINST ('+".                $trimm."') ORDER BY score DESC";
 // Execute the query to  get number of rows that contain search kewords
    $numresults=mysql_query ($query);
    $row_num_links_main = mysql_num_rows($numresults);

doesnt that do the same type of search as the one you suggested?

patk570 42 Newbie Poster

Awesome, I will try that today.

Thanks.

patk570 42 Newbie Poster

not sure, what would the benefit of that be? I am new to programming and such. How would i link the tables and why should the keywords and such be in different categories ?

patk570 42 Newbie Poster
patk570 42 Newbie Poster

I have one database, so in the database i have the table that is libvid, it has the rows catagories, keywords, and title. I removed the one for title, but seems to still pull up titles in the search. I dont know what is going on with this.

here is my new query string..

$query = "SELECT * FROM libvid WHERE keywords LIKE '%$trimm%' OR catagories LIKE '%$trimm%' ORDER BY id DESC";
patk570 42 Newbie Poster

Hello everyone, I have a website I am working on. On this site, I have a form that when you search for just one term, say "legs", it is supposed to pull up everything that is "legs", but not "legs" with "stability ball". My form uses the search term q[] as its name. I will post that in a bit. So what I it to do is search the DB that I have called libvid, to pull the main content like "legs" then when you search additional terms like "stability ball", or "Shoulders" with "Resistance Bands" or even "Glutes", "legs" and "chest".

Here is my form code:

    <form>
    <table border="0" cellpadding="5" cellspacing="5">
        <tr>
            <th colspan="3"> <a href="javascript:void();" onclick="javascript:checkAll('test', true);">Check all exercises</a> | 

<a href="javascript:void();" onclick="javascript:checkAll('test', false);">Uncheck all exercises</a>

            </th>
        </tr>
                <tr>
            <th> </th>
            <th> </th>
            <th> </th>
        </tr>
    </table>
</form>
<form name="test" action="search.php" method="post">
    <table border="0" cellpadding="5" cellspacing="5">

        <tr>
            <th><u>Legs</u></th>
            <th><u>Back</u></th>
            <th><u>Arms</u></th>
        </tr>
        <tr>
            <td>
                <label>
                    <input name="q[]" value="Quadriceps" type="checkbox" />
                    Quadriceps
                </label>
            </td>
            <td>
                <label>
                    <input name="q[]" value="Upper Back" type="checkbox" />
                    Upper Back
                </label>
            </td>
            <td>
                <label>
                    <input name="q[]" value="Biceps" type="checkbox" />
                    Biceps
                </label>
            </td>
        </tr>
        <tr>
            <td>
                <label>
                    <input name="q[]" value="Hamstrings" type="checkbox" />Hamstrings</label>
            </td>
            <td>
                <label>
                    <input name="q[]" value="Lower Back" type="checkbox" />Lower Back</label>
            </td>
            <td>
                <label>
                    <input name="q[]" value="Triceps" type="checkbox" />Triceps</label>
            </td>
        </tr>
        <tr>
            <td>
                <label>
                    <input name="q[]" value="Calves" type="checkbox" />Calves</label>
            </td>
            <td>
                <label>
                    <input name="q[]" value="Trapezius" type="checkbox" />Trapezius</label>
            </td>
            <td>
                <label>
                    <input name="q[]" value="Forarms" type="checkbox" />Forarms</label>
            </td>
        </tr>
        <tr>
            <td colspan="3"> </td>
        </tr>
        <tr>
            <td>
                <label>
                    <input name="q[]" value="Chest" type="checkbox" …
patk570 42 Newbie Poster

Awesome guys, I was looking for something OTHER then Joomla, I HATE their interface and its so hard to update anything on my current website. I think i might try out sugar and vtiger just to get a feel for each. I really do not want to go back to wordpress for my site, that had so many vulerabilities in and constantly updating everything got tiresome. Thanks again for your help and insight to other available options out there!

P.

patk570 42 Newbie Poster

haha, yea CRM is what i wanted. I am trying to create a new website for my business, and need a good backbone. RIght now i have Joomla but i need more features and easier navigation in the admin panel...

patk570 42 Newbie Poster

Besides Wordpress and Joomla, are there any other free CRM or CRM like sites out there? I am looking to get away from Joomla and I am not a big fan of Wordpress anymore. Was wondering if yall knew of any others out there?

patk570 42 Newbie Poster

Acutally, there is one issue that i am running into now with this code. What’s happening is I have an Ajax code, that when you mouse over a div it queries information from the database using a separate page that was created called getusers.php. it then takes that mouseover information and looks for the div that is assigned a number using the row[‘id’] in the database to make it easier well that works and all but the thing that isn’t working is when there is multiple users, it “targets” the first div and that is it.

patk570 42 Newbie Poster

Scratched it from the website...

patk570 42 Newbie Poster

I got it to work. I am a very happy person now. I just needed to change the id of the hidden field, then i needed to change the showUser(user.value) instead of the this.value and put it to load on the div instead of the hidden <---dummy for thinking that ---> but it is resolved now.

patk570 42 Newbie Poster

So I found a code from the W3.schools website. it does what i want, and it even pulls from another page that was created. But when I hover over the link, it does nothing still, here is the Ajax, php and db page:
Ajax:

<script>
function showUser(str)
{
if (str=="")
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getuser.php?q="+str,true);
xmlhttp.send();
}
</script> 

My PHP Script:

        echo "<div class=\"author\"><img align=\"left\" style=\"vertical-align:top;\" class=\"imgb\" height=\"41\" width=\"37\" src=\"profilepics/".$row['pic']."\" /> <input type=\"hidden\" onmouseover=\"showUser(this.value)\" value=\"" .$row['id']."\" />".$row['author']."<br>".$row['timestamp']."<br></div>";

and the DB page:

<?php
$q=$_GET["q"];

$con = mysql_connect('localhost', 'USER', 'PASS');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("DB", $con);

$sql="SELECT * FROM fgusers3 WHERE id = '".$q."'";

$result = mysql_query($sql);

echo "<table border='0'>
<tr>
<th>&nbsp;</th>
<th>Name</th>
<th>Favorite Exercise</th>
<th>Years Exercising</th>
<th>State:</th>
</tr>";

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['profilepic'] . "</td>";
  echo "<td>" . $row['name'] . "</td>";
  echo "<td>" . $row['favexercise'] . "</td>";
  echo "<td>" . $row['yearsexercise'] . "</td>";
  echo "<td>" . $row['state'] . "</td>";
  echo "</tr>";
  }
echo "</table>";

mysql_close($con);
?> 

Please let me know what you see is wrong or not. I only changed a few things from the original, like the link in the PHP from onchange to onmouseover=doscript(); and the database information to connect.

patk570 42 Newbie Poster

I should also probably be clearer. I already have the JQuery working, i need the guts of it. What should be called when they hover over it? how can I make this happen? That is what iam not sure of.

patk570 42 Newbie Poster

the js, very simple and easy.

<script type="text/javascript">
function hideMe()
{
document.getElementById('otheroption2').style.display="none" ;
}
</script>
 <script type="text/javascript">
function showMe()
{
document.getElementById('otheroption2').style.display="block" ;
}
</script>

the html

basic:

            <td><select name="referredby">
<option onclick="return hideMe();" value="Facebook">Facebook</option>
<option onclick="return hideMe();" value="Twitter">Twitter</option>
<option onclick="return hideMe();" value="Angie's List">Angie's List</option>
<option onclick="return hideMe();" value="Google">Google</option>
<option onclick="return hideMe();" value="Bing">Bing</option>
<option onclick="return showMe();"  value="Friend">Friend</option>
<option onclick="return showMe();" value="Other">Other</option>

</select><input type="text" value="Please Specify:" onclick="this.value='';" name="otheroption2" id="otheroption2" style="display:none" />
patk570 42 Newbie Poster

I think hovers on usernames are just fine, it's a normal sort of practice, works well on DW but I can understand onClick may be more efficient web friendly.

I still stand by my original statement that if you are doing mouseovers rather than query the db on a mouseover you should pull all the necessary info for all those users on page request and keep those in a hidden attribute that will only be revealed on mouseover.

It's pretty simple to do.
How easy is it? I am looking at this one option but when it comes to using what they want, i am lost.

http://rndnext.blogspot.in/2009/02/jquery-ajax-tooltip.html

They want me to use CSS, JQuery, and a rel tag that noone has.

any other options out there?

patk570 42 Newbie Poster

I have a form that is very basic, I have 2 fields that call for the hidden input select using a basic JS, what I want to know is if there is a way to make it hide again when they select something different.

Here is my JS:

<script type="text/javascript">
<!--
    function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
    }
//-->
</script>

here is my select and options:

<select name="referredby">
<option value="Facebook">Facebook</option>
<option value="Twitter">Twitter</option>
<option value="Angieslist">Angieslist</option>
<option value="Google">Google</option>
<option value="Bing">Bing</option>
<option onclick="toggle_visibility('otheroption2');" value="Friend">Friend</option>
<option onclick="toggle_visibility('otheroption2');" value="other">Other</option>
</select>
<br />
<input type="text" value="" name="otheroption2" id="otheroption2" style="display:none" />

Basically when they click on Facebook, Twitter, Angieslist, Google and Bing, I want that input to hide again.

patk570 42 Newbie Poster

Wow, I have some research to do then. I am a quick learner, but never really dabbled into Ajax, I am working on this site with a friend of mine and we want to keep the cost low. I do know a small amount of web stuff but by all means no PRO. Thanks everyone for your help and conversing with me to get a resolution on this.

patk570 42 Newbie Poster

what would be the best way to do this? I am not sure what to do. I am not very good at jquery, i am still a noob at this..

patk570 42 Newbie Poster

I am still a noob at coding and such, I do not know jquery very well. I have a blog that when you roll over the members name that posted, I want it to display their details. I am getting confused with the code that I have. If i post my code for the blog/comments section would that be more help?

patk570 42 Newbie Poster

Dani, can I private message you?

patk570 42 Newbie Poster

There is two sections i need it to update. When they hover over the members name listed below, I need it to show their details. When the user(one who submitted the content) posts its going to have a hidden value to update the field in the form that i have a 1 in now. Look for bolded items below.

This is all on the same form, and I would like for the PHP code above to get the userID=???? from the link listed below. Is this possible?

<?PHP
require_once("include/membersite_config.php");

if(!$fgmembersite->CheckLogin())
{
    $fgmembersite->RedirectToURL("login.php");
    exit;
}

?>
    <?php
require_once 'include/myacctconfig.php';
include 'vars.php';
    $id = $_GET['userID'];** <-----Value Needed**

    $query="SELECT * FROM fgusers3 WHERE id_user = $id.";
    $rs = mysql_query($query);
    $details = mysql_fetch_array($rs);


    $query="SELECT * FROM moredetails WHERE id_user = $id." ;
    $rs = mysql_query($query);
    $mdetails = mysql_fetch_array($rs);


?>
<!DOCTYPE html>
<head>
<title>Untitled Document</title>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.8.3.js'></script>
<style type="text/css">
.theDiv {
    display: none;
    margin-top:-7px;
    background-color:#fff;
    width: 500px;
    line-height:100%;
    border:1px solid #c3c3c3;
    background:#fff;
    -moz-border-radius:3px;
    -webkit-border-radius:3px;
    border-radius:3px;
    position: relative;
    padding: 10px;
}
</style>
<script type='text/javascript'>//<![CDATA[ 
$(window).load(function(){
$('.theLinks').hover(
    function () {
        $(this).closest('.content3').next('.theDiv').fadeIn();
    },
    function () {
        $(this).closest('.content3').next('.theDiv').hide();
});
});//]]>  

</script>
</head>
<body>
  <div>
    <div class="content3">
        <div>
            <div class="theLinks">
                <div><a href="<?php echo $_SERVER['PHP_SELF']?>?userID=1">Members Name</a>**<----where it is stored...**
                </div>
            </div>
        </div>
    </div>
    <div class="theDiv">
    <table>
        <tr>
                <td><img class="imgb" align="top" src="profilepics/<?php echo $details['profilepic']; ?>" width="100" height="100">
        </td>
                <td valign="top">Name: <?php echo $details['name'] ?><br><br>Email: <?php echo $details['email'] ?><br><br>Username: <?php echo $details['username'] ?><br><br>Favorite Exercise: <?php echo $mdetails['favexercise']; ?><br><br>Years Exercising: <?php echo $mdetails['yearsexercise']; ?>
        </td>
    </table>
    </div>
    </div>
</body>
</html>
patk570 42 Newbie Poster

Hey guys, I am new to programming and doing everything on my own here. I have a website that I am working on, and i want to add things to a list that is on the side of the search page, and then i want to have it be able to go into a form/PDF page so they can print it out later on.

I was told that a JSON array would be the best for this but i don't know how to program this.

the site that i want to use this one is http://www.patrickspcrepair.com/exercise/

it will show on the search page only and they can add it to the list that is there.

Thanks everyone for your help.

patk570 42 Newbie Poster

the only things that its missing is for it to show $var= something, I just noticed that it was omitted?

patk570 42 Newbie Poster

its there, you can see what its doing now.

patk570 42 Newbie Poster

Im trying to place that in there there but it is erroring out on me:
Parse error: syntax error, unexpected $end in /homepages/36/d301143136/htdocs/PCRJOOMLA/exercise/search.php on line 327

I am working on getting it on there.

patk570 42 Newbie Poster

I kinda do, If you want to see the example, I have it hosted on my website, its still being constructed and i left the debugging on,

http://www.patrickspcrepair.com/exercise

Click on exercise library and you can choose the things you want...

Let me know what you find or need..

patk570 42 Newbie Poster

Hello Minitauros,

here is my echo statement for $query

SELECT title, id, keywords, catagories, emurl FROM libvid WHERE keywords LIKE '%Trapezius%' OR catagories LIKE '%Trapezius%' OR title LIKE '%Trapezius%' IS NOT null ORDER BY title DESCSELECT title, id, keywords, catagories, emurl FROM libvid WHERE keywords LIKE '%Abdominals%' OR catagories LIKE '%Abdominals%' OR title LIKE '%Abdominals%' IS NOT null ORDER BY title DESCSELECT title, id, keywords, catagories, emurl FROM libvid WHERE keywords LIKE '%Triceps%' OR catagories LIKE '%Triceps%' OR title LIKE '%Triceps%' IS NOT null ORDER BY title DESC
patk570 42 Newbie Poster

What it is doing when i get the results back from the database is it is returning basically EVERYTHING from the database because it is searching for the "," and the space as well. I have tried using

$var = str_replace(",", "",$var); 

and it did get rid of the commas, but now i need to get rid of the whitespace between the variables, So instead of using what is on Line 5 of the code, i am wondering if ther eis a a way to use a foreach statement to fix it and still return results on both a single word and multiple words.

patk570 42 Newbie Poster

What it is doing when i get the results back from the database is it is returning basically EVERYTHING from the database because it is searching for the "," and the space as well. I have tried using

$var = str_replace(",", "",$var); 

and it did get rid of the commas, but now i need to get rid of the whitespace between the variables, So instead of using what is on Line 5 of the code, i am wondering if ther eis a a way to use a foreach statement to fix it and still return results on both a single word and multiple words.

patk570 42 Newbie Poster

Quoted Text Damn that is a whole lot of code man. Would you be so kind to specify the lines that you would like us to look at? By the way, on a side note, using $_REQUEST is considered unsafe/risky, as it may get defined by $_COOKIE, $_GET and $_POST values, which means it leaves room for malicious injections and stuff plus you might end up using the wrong data (if you have the same key in a $_GET, $_POST and $_COOKIE).
Here^^

It is line 5, that is where i am getting the array of q and turning it into a $var.

patk570 42 Newbie Poster

Quoted Text Damn that is a whole lot of code man. Would you be so kind to specify the lines that you would like us to look at? By the way, on a side note, using $_REQUEST is considered unsafe/risky, as it may get defined by $_COOKIE, $_GET and $_POST values, which means it leaves room for malicious injections and stuff plus you might end up using the wrong data (if you have the same key in a $_GET, $_POST and $_COOKIE).
Here^^

It is line 5, that is where i am getting the array of q and turning it into a $var.

patk570 42 Newbie Poster

Hello everyone,

I have a search form that i am working on, and I have a huge array of checkboxes that I am using so people can refine the search down to just 1 or 2 things if they want to. In the search.php page, i have an implode function to return the array down to a string so it can be passed through the query. But now something strange has happened, it return everything because it is searching for a Comma(,) and a Space and returning all the results on the search page...

I would like to know if there is a way to take

$var = mysql_real_escape_string(implode(', ', $_REQUEST['q']));

and make it for friendly for the query maybe using a foreach statement or something else to handle the array of checkboxes that I have.

Here is the rest of the code i have for the php search and I will attach the checkbox array incase I made a mistake on that.

Thanks everyone in advance for your help.

Patrick.

<?php
$limit = 27;

//get the search variable from URL
$var = mysql_real_escape_string(implode(', ', $_REQUEST['q']));

//get pagination
$s = mysql_real_escape_string($_REQUEST['s']);

//set keyword character limit
if(strlen($var) < 3){
    $resultmsg =  "<p>Search Error</p><p>Keywords with less then three characters are omitted...</p>" ;
}
//trim whitespace from the stored variable
$trimmed = trim($var);
$trimmed1 = trim($var);
//separate key-phrases into keywords
$trimmed_array = explode(" ",$trimmed);
$trimmed_array1 = explode(" ",$trimmed1);

// check for an empty string and display a message.
if ($trimmed == "") …
patk570 42 Newbie Poster

forget the above response,

I got it to not error out, but i think the error that i am having is i have to put:
echo '<a href="#" onclick="popup(\'<?php echo $page ?>\')"></a>

to make the code work propery and not cause a parse error

patk570 42 Newbie Poster

Ok, this is how i have the section of code:

echo '<div class="search-result">';
                echo '<div class="search-title">Video Title: '.$title.'</div>';
                echo '<div class="search-link">';
                echo '<a href="#" onclick="popup('<?php echo $page ?>')"><img src=http://i3.ytimg.com/vi/'.$link.'/0.jpg width="236" height="147" /></a>';
                    $page = 'popup.php?view&var1=$title&var2=$link&var3=$instr';
                echo '</div>';
                echo '<div class="search-cata">';
                echo '<p><font size="-2" >Catagories: '.$cata. '</font></p>';
                echo '</div>';
                echo '<br />';
                echo '<br />';
            echo '</div>';

but getting this parse error:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /homepages/36/d301143136/htdocs/omitted/search.php on line 181

patk570 42 Newbie Poster

Still nothing on the popup side.

This is what i get for the url: http://OMITTED/popup.php?view&var1&var2&var3

patk570 42 Newbie Poster

If you can't echo the title then there's something wrong with your query from the file not from the popup window.

No I cannot get anything to pass through.

patk570 42 Newbie Poster

Kinda, I am trying to get the variables to pass through so we can view the video on a seperate page. I have tried many different things to get the variables of the table to pass, but it wont. On the popup window, it just needs to be simple, the title, url for embed, and instructions. The reason we are doing this is just for instructional videos that repeat on a loop, most are no more then 15 seconds long, but we need them to echo to the popup for ease...

patk570 42 Newbie Poster

Im just trying to echo the variables from the main page to the popup, can you please help me?

patk570 42 Newbie Poster

Hey guys, below is my code, I am working on trying to PASS Variables to a popup window. I have it to where it show the embed window(which is blank) link, the title(which is blank) and instuctions(which is blank), but I cannot get it to pass the variables of what I want to the popup window. I will also append the popup window for you. Thanks everyone for your help.

<!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>Exercise Video Library</title>
<link href="twoColHybLtHdr.css" rel="stylesheet" type="text/css" /><!--[if IE]>
<style type="text/css"> 
/* place css fixes for all versions of IE in this conditional comment */
.twoColHybLtHdr #sidebar1 { padding-top: 30px; }
.twoColHybLtHdr #mainContent { zoom: 1; padding-top: 15px; }
/* the above proprietary zoom property gives IE the hasLayout it may need to avoid several bugs */
</style>
<![endif]-->
<script type="text/javascript">
function showactiveLink(){
document.getElementById("arrow").innerHTML = "<img src='images/smallArrow.gif'>";
}
</script>
<script type="text/javascript">
function loadwindow(page){
window.open(page,"popup","width=560,height=800,status=1")
} 
</script>
</head>

<body onload="showactiveLink()" class="twoColHybLtHdr">

<div id="container">
  <div id="header">
    <div><h1><font color="red">Exercise Video Library</font></h1></div>
    <div id="search-form" align="right"><form id="search-block-form" action="search.php" method="get"><input type="text" name="q" /><input id="divbutton" title="Search" name="search" alt="Search" type="submit" value="" /></form></div>
    <div align="right" id="contactinfo">Contact Us: (719) 576-2256</div>
    <div align="Center" id="navigation"><a href="index.html">Home</a> | <a href="library.html">Excercise Library</a> | Tutorials | Sample Workouts | <a href="design-your-workout.html">Design Your Workout</a> | Health & Fitness Assessment </div>
  <!-- end #header --></div>
  <div>&nbsp;</div>
  <div>&nbsp;</div>
  <div id="sidebar1">
    <h3>Quick Links</h3>
    <li>Master Food list</li><br />
    <li>Workout/Nutrition Logs</li><br />
    <li>Fitness Terms &amp; Definations</li><br />
    <li>Rehbilitation Tips</li>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<li>Injury Recovery</li> …
patk570 42 Newbie Poster

Lines 25 Down will not display the results. Yes i got the code from there. I am wanting it to do more now. making it a bit more powerful.

ANy ideas on what might be the cause. I have looked it over and over and change a few things but to no avail. it is still blank.

patk570 42 Newbie Poster

I am trying to append the code to display the results of the database by including a link, I got the link to work, but it will not display the results when clicked. Below is the code, If you can help me that would be great! Thanks

<?php
//if we got something through $_POST
if (isset($_POST['search'])) {
    // here you would normally include some database connection
    include('db.php');
    $db = new db();
    // never trust what user wrote! We must ALWAYS sanitize user input
    $word = mysql_real_escape_string($_POST['search']);
    // build your search query to the database
    $sql = "SELECT Customer_Name, ID FROM Client_Computer_Info WHERE Customer_Name LIKE '%" . $word . "%' ORDER BY ID LIMIT 10";
    // get results
    $row = $db->select_list($sql);
    if(count($row)) {
        $end_result = '';
        foreach($row as $r) {
            $result         = "\n\t<li><a href=\"search.php?ID={$r['ID']}\">{$r['Customer_Name']}</a></li>";
            // we will use this to bold the search word in result
            $bold           = '<span class="found">' . $word . '</span>';
            $end_result     .= '<li>' . str_ireplace($word, $bold, $result) . '</li>';
        }
        echo $end_result;
    } else {
        echo "<p>Sorry no results for $word</p>";
        }
    }elseif(isset($_GET['ID'])){
    $id = intval($_GET['ID']);
    $query = "SELECT Customer_Name, Computer_Type, Computer_Make, Computer_Model, Serial_Number, Product_Number, OS, `Key` FROM Client_Computer_Info WHERE ID = $id LIMIT 1";
    $n = mysql_query($query);
    echo mysql_error();
    if(mysql_num_rows($n) == 1){
    $d = mysql_fetch_array($n);
    $result  .=     "
    \n<p>Name: {$n['Customer_Name']}</p>
    \n<p>Computer Type: {$n['Computer_Type']}</p>
    \n<p>Computer Make: {$n['Computer_Make']}</p>
    \n<p>Computer Model: {$n['Computer_Model']}</p>
    \n<p>Serial Number: {$n['Serial_Number']}</p>
    \n<p>Product Number: {$n['Product_Number']}</p>
    \n<p>OS: {$n['OS']}</p>
    \n<p>Key: {$n['Key']}</p>";
    }else{
    $result  = "<p>Sorry the ID supplied for the customer does not exist.</p>";
    }
    }
?>
patk570 42 Newbie Poster

I am running into an error on a javascript problem I have it display if the math problem is wrong, and an alert box that pops up, but when you hit OKAY on the alert box it still submits the form. I am wondering if there is an easy fix to this or not. I will post my code in a min here. I would really appreciate some help on this if you have the time. I have researched this for a while and rewrote my code many times but still not working. The part of the code i am looking for help on is the "function ValidBotBoot()"

            <!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>
    <title>Family Recipes | Share Your Passion</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta http-equiv="Content-type" content="text/html; charset=utf-8"><meta name="language" content="en">
    <link href="style.css" rel="stylesheet" type="text/css">
    <style type="text/css">

    .main {
    width:200px;
    border:1px solid black;
    }

    .month {
    background-color:black;
    font:bold 12px verdana;
    color:white;
    }

    .daysofweek {
    background-color:gray;
    font:bold 12px verdana;
    color:white;
    }

    .days {
    font-size: 12px;
    font-family:verdana;
    color:black;
    background-color: lightyellow;
    padding: 2px;
    }

    .days #today{
    font-weight: bold;
    color: red;
    }
    .tb5 {
        height: 22px;
        width: 230px;
    }
    .tb5a {
        background: url(rounded.gif) no-repeat top left;
        border: 0;
        width:220px;
        margin-top:3px;
    }
    </style>
    <script type="text/javascript" src="basiccalendar.js"></script>

    <script src="gen_validatorv4.js" type="text/javascript"></script>

    <script type="text/javascript">
        var a = Math.ceil(Math.random() * 20);
        var b = Math.ceil(Math.random() * 20);       
        var c = a + b
        function DrawBotBoot()
        {
            document.write("What is "+ a + " + " + b +"? …
patk570 42 Newbie Poster

Hello everyone. I seem to be having trouble with the doMath() section of my code. I was wondering if you can help me out...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Package Plans</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<SCRIPT LANGUAGE="JavaScript">
function  doMath() {
var one = eval(document.theForm.elements[0].value);
var two = eval(document.theForm.elements[1].value);
var outp = "";
var outps = "";
	{
    ans = one*two;
    ansq = (one*two)*12;
    outp = " " + "$" + ans.toFixed(2) + "/Month";
    outps = " " + "$" + ansq.toFixed(2) + "/Year";

}
  document.getElementById('outtab').innerHTML = outp;
document.getElementById('outtab1').innerHTML = outps;
} 
</SCRIPT>
<script type="text/javascript">
function calcPackage(){
var text = document.getElementById('price');
var rad=document.one.gb;
for(var i=0;i<rad.length;i++){
	if(rad[i].checked){
		switch(rad[i].value){
		case '5':text.value = '2.50';break;
		case '10':text.value = '2.00';break;
		case '15':text.value = '2.00';break;
		case '20':text.value = '1.75';break;
		case '30':text.value = '1.25';break;
		case '50':text.value = '0.80';break;
		case '100':text.value = '0.50';break;
		default: text='';break;
		}
	}
}
document.getElementById('price').innerHTML = text;
}
</script>
</head>
<body>
<form name="one" onClick="calcPackage()">
		<fieldset>
	 		<p><strong>Choose a type of fruit, then click the button below:</strong><br/>				 
	 		<input type="radio" name="gb" value="5">I just use my computer for email and surfing the web.  I have a few documents and other files I need to back up.<br/>
	 		<input type="radio" name="gb" value="10">
	 		I have some music and a few files, I am in school/college and need to backup my work.<br/>
	 		<input type="radio" name="gb" value="15">
	 		I have 50 songs, pictures, and documents, I do not want to lose.
	 		<br/>
	 		<input type="radio" name="gb" value="20">
	 		I have a lot of …
patk570 42 Newbie Poster

What about something like this? Am I Close?

<!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>Calc Price</title>
<SCRIPT LANGUAGE="JavaScript">
function  doMath() {
var one = eval(document.theForm.elements[0].value);
var two = eval(document.theForm.elements[1].value);
var outp = "";
var outps = "";
	{
    ans = one*two;
    ansq = (one*two)*12;
    outp = " " + "$" + ans.toFixed(2) + "/Month";
    outps = " " + "$" + ansq.toFixed(2) + "/Year";

}
  document.getElementById('outtab').innerHTML = outp;
document.getElementById('outtab1').innerHTML = outps;
} 
</SCRIPT>
<script type="text/javascript">

function switchme(SNewSel) {

var sNewSel = document.getElementById("selection");
switch (sNewSel)
{
case "1": 
document.getElementById("price") = "2.00";
break;

case "2": 
document.getElementById("price") = "1.00"
break;

case "3": 
document.getElementById("price") = "0.75"
break;

case "4": 
document.getElementById("price") = "0.50"
break;

default: // unknown value -- do nothing
break;
}
}
</script>
</head>
<body>
<div>
<form name="theForm">
<p>Please select amount of GB:</p>
<select id="selection" name="one" onchange="switchme(this.value)">
  <option value="Choose">Please Choose</option>
  <option value="5">5</option>
  <option value="10">10</option>
  <option value="15">15</option>
  <option value="20">20</option>
  <option value="30">30</option>
  <option value="50">50</option>
  <option value="100">100</option>
</select>

<p>Price</p>
$<input id="price" name="two" DISABLED type="text" size="6" value="2.00">/GB

<BR><BR>Monthly Total:<SPAN ID="outtab"></SPAN>
<br>Yearly Total:<SPAN ID="outtab1"></SPAN>
<br><BR>
<input type="button" onclick="doMath()" value="Calculate Total" >
</form>
</div>
</body>
</html>
patk570 42 Newbie Poster

oops, if 10 and 15 are selected case 1, if 20, case 2, if 30 is selected case 3 then the rest is case 4

patk570 42 Newbie Poster

So now I want to do something a little different since i have a basic code there. I want to add a case switch to it. I want to price to change when they select certain one from the options...is there anyway of incorporating that?

<option selected="selected">5</option>
  <option>10</option>
  <option>15</option>
  <option>20</option>
  <option>30</option>
  <option>50</option>
  <option>100</option>
</select>

Like say:

case 1: document.write('2.00'); break;
case 2: document.write('1.00'); break;
case 3: document.write('0.75'); break;
case 4: document.write('0.50'); break;

and have it displayed in the

$<input name="two" DISABLED type="text" size="4" value="2.00">
patk570 42 Newbie Poster

Thanks, Airshow I didn't think of that! lol...