Jump to content

sunfighter

Members
  • Posts

    579
  • Joined

  • Last visited

    Never

Posts posted by sunfighter

  1. A while loop has to have opening and closing curly brackets to define the action.

     

    echo "<ul>";
    while($row = mysql_fetch_row($result))
    {
    echo "<li>".$row['insect_science']."</li>";
    echo "<li>".$row['insect_com']."</li>";
    }
    echo "</ul>";
    

     

    Or:

    echo "<ul>";
    while($row = mysql_fetch_row($result))
    {
    echo "<li>".$row['insect_science']." -- ";
    echo $row['insect_com']."</li>";
    }
    echo "</ul>";
    

  2. This is not an easy task. You do need to give more time to what you means by

    allow for a user to view titles based on the category, title, etc .

    Is it an alphabetical order of authors and are you committed to doing this in php only? Does view  by category mean only Romance novels or alphabetical listing of the categorizes?

     

    Anyway the display is probably easier to do with a table. You echo out the table heading and css info. Here is how to get the info out of the array and into a row:

    <?php
    $category = $books[1]["category"];
    $title = $books[1]["title"];
    $author = $books[1]["author"];
    $publisher = $books[1]["publisher"];
    $price = $books[1]["price"];
    $isbn = $books[1]["isbn"];
    
    echo <<<EOD
    <tr>
    <td>$category</td>
    <td>$title</td>
    <td>$author</td>
    <td>$publisher</td>
    <td>$price</td>
    <td>$isbn</td>
    </tr>
    EOD;
    ?>
    

  3. While I see you added the phone number to the evaluation and to

    $res = addUser($_POST['username'],$_POST['password'],$_POST['email'], $_POST['phone'],'test_3.php');

     

    You have not added it to the function

    function addUser($user,$pass,$email,$site_url)

    Nor to the insert

    $sql = "INSERT INTO users (username,password,email,active,level_access,reg_date) VALUES ('".$user."','".$pass."','".$email."',0,2,'".$reg_date."')";

     

    Have you added a column to the database for the phone number?

  4. I find $eventname in four places in your code

    $eventname = str_replace("", "", $row['eventname']);
    
    <a 
    href='index.php?view=event&content=tips&ttid=$eventid' 
    title ='$eventname' 
    class=\"fancybox fancybox.iframe\"  
    style=\"color:#104E8B;text-decoration: none; \" >
    <strong><font size='2' face='Segoe UI'  >$eventname</font></strong>
    </a>
    
    
    
    <a href='index.php?view=event&content=speaker&ttid=$eventid'  title ='$eventname' class='fancybox fancybox.iframe' >$showsl</a>
    

     

    The first,

    $eventname = str_replace("", "", $row['eventname']);

    is where $eventname is defined. The str_replace() doesn't do anything, but doesn't hurt either. Maybe from old code. Could be remove for easier understanding of code.

    $eventname = $row['eventname'];

     

    It's the second group that I think you should send the $eventname to the next file.

     

    I'd do this:

    change

    href='index.php?view=event&content=tips&ttid=$eventid' 

    To this

    href='index.php?view=event&content=tips&ttid=$eventid&eventname=$eventname' 

     

    and in index.php add this line

    $eventname = $_GET['eventname'];

    after the

    $SOME THING  = $_GET['ttid'];

  5. I would use something like '*' to seperate your questions so file looks like this:

    *HTML is...,Main markup language for web pages,Cross-site Security,Cleverly Structured Scripting,eXtremely Safe and Secure,*PHP...,General-purpose server-side scripting language,Cross-site Security,Processing Hypertext Products,Process HTML Prettily

     

    Then look up the php explode() function . The explode() function breaks a string into an array.

    http://www.w3schools.com/php/func_string_explode.asp

  6. FYI: $event_name is nowhere to be found in either submission and the first code comes to an abrupt end.

     

    There has to be a button or something to move from one page to another. Though your code does not show it, it looka like it comes from the dropdown in the second code. If yes try  doing a simple GET add on to the url by adding '?subject=event_name'.

  7. OK I guess I don't know what you want. I see three drop down menus that you want populated, right?

    I don't know what you want in the top dropdown because it is blank. But think it's the state. Right?

    The second dropdown has 'select city' in it and I thought you needed to find the cities that came from the first dropdown choice. Which should be the state or as you call it statecode and that came from the first or top dropdown.

     

    Is that right?

     

    And then you want to get the market and put that in the select market dropdown, the third one. Is that right? And where (table and column) is that info and what is the city column needed for that extraction?

     

    I gave you the query to get the second dropdown information after the state was picked in the first.

    You say this don't work? Your not getting the city names?

  8. Of course I read it. It's true advise and it's all over the web.

     

    I would have spent my time working this out for newphpcoder if he didn't plaster it all over the web himself. I just have an aversion to people that do that without waiting for one form to yield an answer. He did this as fast as he could post pitting one form against another.

  9. You can do this a couple of ways:

    echo "<span style=\"color:red;\">Location: ". $row['Location'] . "</span><br>";

     

    or make a CSS section and do this:

     

    echo "<span id=\"location\">Location: ". $row['Location'] . "</span><br>";

     

    The \n is not needed in your code.

  10. Your query does not look healthy

    $str="SELECT citycode,cityname 
    FROM city 
    WHERE statecode 
    IN ( 
    SELECT statecode 
    FROM city 
    JOIN state ON city.statecode = $id)"; 
    

     

    This is what I think you want

    $str="SELECT citycode, cityname 
    FROM city 
    WHERE statecode = $id";
    

     

    And you should has something in your first dropdown. Yours is empty. And I would not use 'action' as the name of a function. I'm sure it's a reserved word, but too lasy to look it up. Try "get_select" instead.

  11. Found these on the web:

    1. Use the program HTML Tidy with its word2000 option

     

    2. Find & Replace in Word: use the find function to find italized text, then use replace with <em>^&</em>. Then use a word macro, or script in your favorite text editor, to replace all the 'smart' quotation marks, character encodings, etc.

     

    3. Save as an RTF file in word, then use DocFrac to convert it to HTML.

     

     

     

    HTML Tidy can be found here: http://infohound.net/tidy/

  12. Check this reall good.

    I only did it on the fly and just a couple of numbers

     

    <!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" xml:lang="en" lang="en">
    <head>
    <title>The greatest page title ever</title>
    <script src="./lib/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    function calculate(myForm)
    {
    //document.getElementById('area').value = Number(document.getElementById('length').value);
    
    document.getElementById('area').value = Number(document.getElementById('length').value) * Number(document.getElementById('height').value);
    var interum = Number(document.getElementById('area').value) * Number(document.getElementById('priceperunit').value);
    document.getElementById('totalprice').value = Math.round(interum*100)/100
    }
    </script>
    </head>
    
    <body>
    <form id="myForm">
    
    length :<input type="text" id="length" /><br />
    height :<input type="text" id="height" /><br />
    price  :<input type="text" id="priceperunit" /><br />
    <input type="text" id="area" />area<br />
    <input type="text" id="totalprice" />totalprice<br />
    <input type="button" onclick="calculate('myForm')" />
    </form>
    
    </body>
    </html>

×
×
  • 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.