www.webdeveloper.com
Results 1 to 7 of 7

Thread: Syntax error with form code.

  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

  2. #2
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    853
    You're issuing php code inside your html (outside of php mode).

  3. #3
    Join Date
    Jun 2014
    Posts
    5
    error_reporting(E_ALL | E_NOTICE);
    ini_set('display_errors', '1');

    not sure where I put above.
    also how do i fix my code so html and php is seperate.

    any ideas of the best way to call the amazon api and how do i pass variables to it?

  4. #4
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    853
    With your rather limited php skills, how do you propose to interface to an api? Have you programmed in some other language?

  5. #5
    Join Date
    Jun 2014
    Posts
    5

    Smile Hi

    Quote Originally Posted by ginerjm View Post
    With your rather limited php skills, how do you propose to interface to an api? Have you programmed in some other language?
    I used to program in C but many years ago. I am just looking for some help i know it has something to do with tags , i am surprised you have to do forms in html not php. If you can help with my coding i would appreciate it.

  6. #6
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    853
    No thanks.

    1 - no experience in working with apis
    2 - no experience with Wordpress
    3 - your failure to RTFM to understand what I've shown so far leaves me with no appetite for assisting you.

  7. #7
    Join Date
    Jun 2014
    Posts
    5

    Cool hi

    Quote Originally Posted by ginerjm View Post
    No thanks.

    1 - no experience in working with apis
    2 - no experience with Wordpress
    3 - your failure to RTFM to understand what I've shown so far leaves me with no appetite for assisting you.
    I got some of my code from an API book for Amazon but they don't show you the full picture on how to search and retrieve any product. I have purchased plugins but would like to design my own.
    I have plenty experience of Wordpress my web site has had 300,000 hits in half a year.

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