www.webdeveloper.com
Results 1 to 7 of 7

Thread: Syntax error with form code.

Threaded View

  1. #1
    Join Date
    Jun 2014
    Posts
    5

    Red face Syntax error with form code.

    PHP Code:
    add_action'admin_menu''boj_menuexample_create_menu' );

    //  Then you actually have to declare the functions that will generate the pages/page content.
    function boj_menuexample_settings_page() {

      echo 
    "<h1>Settings Page</h1>";

    }
    function 
    boj_menuexample_about_page() {

      echo 
    "<h1>APPLICATION</h1>";

    function 
    displayBook ($resultItems)
    {
    foreach (
    $resultItems AS $item)
    {
    $title $item['ProductName'];
    $url $item['Url'];
    $image $item['ImageUrlSmall'];
    $authorList implode($item['Authors'], ", ");
    $price $item['ListPrice'];
    if (
    $url != "") echo "<img src=\"$image\" align=\"left\">";
    echo 
    "<a href=\"$url\" title=\" Learn More at Amazon.com\">$title<a><br>";
    echo 
    "Author(s): "$authorList"<br>";
    echo 
    "List Price:" $price;
    echo 
    "<br>";
    }
    }

    function 
    runSearchQuery($client$keywords$page$mode $type='lite')

    {
    $params = array(
    'keyword' => $keywords,
    'page' => $page,
    'mode' => $mode,
    'tag' => 'xymalfsentert',
    'type' => $type,
    'devtag' => 'AKIAIQ2ZQ6JWDC',

    );

    $namespace 'http://soap.amazon.com';
    $action 'http://soap.amazon.com';
    $method "KeywordSearchRequest";
    $result $client->call($methos, array('KeywordSearchRequest' =>$params),
    $namespace$action);

    return 
    $result;

    }

    ### showing syntax error here ###
    <form action="./soap.search.php" method ="get">
    <
    input type="text" name="query">
    <
    input type="hidden" name="page" value="1">
    <
    select name="mode">

    $modes = array();
    $modes[] = "books";


    foreach (
    $modes as $mode)
    {
    echo 
    "<option value =\"$mode\">$mode</option>";
    }
    </
    select>
    <
    input type="submit">
    </
    form>



    $resultItems $result['Details'];

    switch (
    $mode)
    {
    case 
    "books":
    displayBook($resultItems);
    break;
    }
    if (
    $result['TotalPages'] > $page)
    {
    $page++;
    echo 
    "<a href=\"soap.search.php?query&mode&page=$page\"> Next 10 Results</a>";
    }




    }
    function 
    boj_menuexample_uninstall_page() {

      echo 
    "<h1>Uninstall Page</h1>";

    }

    ?> 
    I am trying to develop a wordpress plugin on a local host WAMP server but getting a syntax error where i have put a form into the code.

    Also ideally I would like to put the two amazon tags on a seperate settings page.

    Not sure whether it is best to use SOAP or Amazon Api and not sure exactly how to do this. I just want to search by product names and categories - query Amazon - save data in a table which will then be posted with affiliate ID attached to a buy now button.

    Any ideas on how to do this?
    Last edited by NogDog; 07-02-2014 at 02:42 PM. Reason: added [php] tags around code

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles