×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    3

    Unhappy PHP session problem help! Plz~~

    I used XHTML + PHP to make a simple shopping list service for my wap site. (While pressing an "Add" button on a recipe page, the ingredients will be listed on the Shopping list page.)

    The two php pages (recipe.php and shopping. php) worked on PC but not on cell phones. I've been struggling with them for two weeks but ended up with nothing. Would anyone here please please help me correct the code?

    recipe1.php

    <?php
    session_start();
    ?>
    <?php header('Content-type: text/html'); ?>
    <?php echo '<?xml version="1.0"?' . '>'; ?>

    <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Cakes</title>
    <link href="../mobile.css" rel="stylesheet" type="text/css" />
    </head>
    <body>

    <p class="red">Ingredients:</p>
    <ul class="list">
    <?php
    require_once('../config.php');

    $con = mysql_connect($db_host, $db_user, $db_pass)
    or die('Unable to connect to database');
    mysql_select_db($db_name, $con)
    or die('Unable to select database');

    // changing name = to recipe name
    $query = "SELECT * FROM recipe WHERE name = 'Apple Cloud Cake'";
    $result = mysql_query($query)
    or die('Error in query');

    if (mysql_num_rows($result) > 0)
    {
    while ($row = mysql_fetch_row($result))
    {
    $ingredient = $row[2];
    // Extracting ingredient with <br /> as the delimiter
    $inArray = explode('<br />', $ingredient);
    }

    // Run through the array
    echo '<form action="', $_SERVER['PHP_SELF'], '" method="POST" name="checkboxAll">';
    for ($i = 0; $i < count($inArray) - 1; $i++)
    {
    echo '<li>', $inArray[$i], '</li>';
    // Extracting ingredient with - as the delimiter
    $shortname = strtok($inArray[$i], '-');
    if ($_POST['submit'] || $_POST['submit.x'] || $_POST['submit_y'])
    {
    $_SESSION['acc' . $i] = $shortname;
    }
    }
    echo '<input type="image" src="../shopping.gif" name="submit" value="Add to Shopping List"></form>';
    //echo '<input type="submit" name="submit" value="Add to Shopping List"></form>';
    }
    else
    {
    echo 'No ingredient';
    }
    mysql_free_result($result);
    mysql_close($con);
    ?>
    </ul>
    </body>
    </html>

    shopping.php
    <?php
    session_start();
    ?>
    <?php header('Content-type: text/html'); ?>
    <?php echo "<?xml version=\"1.0\"?".">"; ?>
    <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Shopping List</title>
    <link rel="stylesheet" type="text/css" href="mobile.css" />
    </head>

    <body>
    <?php
    require_once('../config.php');

    if ($_POST['empty'])
    {
    $_SESSION = array();
    session_destroy();
    }

    if (!empty($_SESSION))
    {
    echo 'Shopping list<br /><br />';
    $noDupList = array_unique($_SESSION);

    foreach ($noDupList as $name)
    {
    echo '<input type="checkbox"> ', $name, '<br />';
    }
    }
    else
    {
    echo 'Your shopping list is empty<br />';
    }
    ?>

    </body>
    </html>

  2. #2
    Registered User
    Join Date
    Dec 2005
    Posts
    7

    Re: PHP session problem help! Plz~~

    Hey, just wondering, how and where have you uploaded this code to make it accessible from a 'real' mobile phone?

    Chuck

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    3

    Re: PHP session problem help! Plz~~

    Hi Chuck,

    I'm using GoDaddy's server. Cell phones can browse the regular web, so just upload your site to any web server than you're done.

  4. #4
    Registered User
    Join Date
    Dec 2005
    Posts
    7

    Re: PHP session problem help! Plz~~

    Thanks for the reply, how much this cost, and what should I exactly purchase in order to view my WAP page from a 'real' mobile phone...

    I understand they have domains, servers etc, but am not sure what I exactly need.

    Any help will be greatly appreciated, Thanx again in advance...

    Chuck

  5. #5
    Registered User
    Join Date
    Jan 2006
    Posts
    1

    Re: PHP session problem help! Plz~~

    Hi, I have the same problem
    Do you have you found the solution ?

  6. #6
    Registered User
    Join Date
    Feb 2004
    Location
    chennai,india
    Posts
    9

    Re: PHP session problem help! Plz~~

    lol...

    html does not work on most mobiles....use wml or xhtml... you can test your pages using nokia mobile internet toolkit or even try opera web browser

Similar Threads

  1. Ringing problem with Nokia N70
    By DVogdos in forum Audio
    Replies: 2
    Last Post: 2007-06-26, 20:49
  2. GPRS session 6310i
    By ei98hfn in forum Mobile Java General
    Replies: 2
    Last Post: 2002-09-19, 13:42

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×