Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8406417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:06:17+00:00 2026-06-09T23:06:17+00:00

I have the following php and wish to know how I can achieve that

  • 0

I have the following php and wish to know how I can achieve that the bottom part of the script is rerun with the new input value when the submit button is clicked.

I feel that my script needs just a final touch, but when you think another approach is preferred then don’t refrain from making suggestions.

I do know how to assign a javascript to a button but here I wish to rerun only the bottom code (creating soap client, calling soap web service and applying xslt to the resulting XML) and wish to have that in php (mainly because I don’t know the equivalent in ECMA script but also because the script takes care of placing the resulting table on the spot I wish to have it).

<!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>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <title>Get element details</title>
    <style type="text/css">
        @import url("Swift.css");
    </style>
</head>
<body>
    <br/>
<?php # httpCallExample2.php

    echo '<form action="httpCallExample2.php" method="post">
        <fieldset>
            <legend>Get element details</legend>
            <p>
                Element: <input name="element" type="text" size="12" maxlength="12" />&nbsp; &nbsp; <button type="submit" name="submit" value="update">Get details</button>
            </p>
        </fieldset>
    </form>
    ';
    echo '<br/>';

    $soapReq = new SoapClient('http://www.webservicex.net/periodictable.asmx?WSDL');
    $input = array ("ElementName" => $element);

    $result = $soapReq ->
        __soapCall("GetAtomicNumber",
            array(
                'parameters' => $input
            )
        );

    $XML = new DOMDocument();
    $XML -> loadXML ( $result -> GetAtomicNumberResult );

    $xslt = new XSLTProcessor();
    $XSL = new DOMDocument();
    $XSL -> load('showResults.xslt');
    $xslt -> importStylesheet( $XSL );

    echo $xslt -> transformToXML( $XML );

?>
</body>
</html>

Don’t mind about the css file (that contains just some table layout stuff) but here’s the xslt I use:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:template match="/">
        <table>
            <thead>
                <tr>
                    <th colspan="2">SOAP results</th>
                </tr>
            </thead>
            <tbody>
                <xsl:for-each select="//NewDataSet/Table/*">
                    <tr>
                        <td><xsl:value-of select="name()"/></td>
                        <td><xsl:value-of select="."/></td>
                    </tr>
                </xsl:for-each>
            </tbody>
        </table>
    </xsl:template>
</xsl:stylesheet>

The resulting page should look something like

result

Where I expect the bottom part to be filled after the input element has been given the value Carbon and the submit button has been clicked.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T23:06:18+00:00Added an answer on June 9, 2026 at 11:06 pm

    I had hoped that someone would help me out, but as always I could not leave it alone and went on to try to find a solution.
    And I did: the trick is to reopen the php file and pass the element value to it, accessible by using the expression $_POST[‘element’] (or $_GET[‘element’], when using get method instead of post).

    The end result that I reached was the following:

    <!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>
        <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
        <title>Get element details</title>
        <style type="text/css">
            @import url("Swift.css");
        </style>
    </head>
    <body>
        <br/>
    <?php
        echo '<form action="httpCallExample2.php" method="post">
            <fieldset>
                <legend>Get element details</legend>
                <p>
                    Element: <input name="element" type="text" size="12" maxlength="12" />&nbsp; &nbsp; <input type="submit" value="Get details"/>
                </p>
            </fieldset>
        </form>
        ';
    ?>
        <br/>
    
    <?php
        if (!empty($_POST['element'])) {
            $soapReq = new SoapClient('http://www.webservicex.net/periodictable.asmx?WSDL');
            $input = array ("ElementName" => $_POST['element'];
    
            $result = $soapReq ->
                __soapCall("GetAtomicNumber",
                    array(
                        'parameters' => $input
                    )
                );
    
            $XML = new DOMDocument();
            $XML -> loadXML ( $result -> GetAtomicNumberResult );
    
            $xslt = new XSLTProcessor();
            $XSL = new DOMDocument();
            $XSL -> load('showResults.xslt');
            $xslt -> importStylesheet( $XSL );
    
            echo $xslt -> transformToXML( $XML );
        }
    ?>
    </body>
    </html>
    

    resulting in just the input form first, and when entering (for example) potassium and clicking the button, this gives

    result2

    of course, it is possible to enter the posted value into the input element again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following html form: <form method=post action=> <input type=hidden name=userid id=user value=<?php echo
I'm new to web programming and I have the following form that I wish
I have the following PHP code, and for the life of me I can't
I have the following PHP script: <?php $vote_type = $_GET['type']; $book = $_GET['book']; $id
I have the following PHP script with the working (according to JsonViewer ) JSON
All, I have a PHP application that seems to generate the following headers in
I have a (PHP) script which runs on a new row in MySQL. However,
I have following PHP script. I want to count and print comments for each
I have the following php script: <?php session_start(); global $db; $cart = $_SESSION['cart']; if
I have following PHP code $val=<div id=user.$row['cid']. userid=.$row['cid']. class=innertxt><img src=images/images.jpg width=50 height=50><strong>.$uname.</strong><ul> <li>Email: .$row['cemail'].</li>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.