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 7556401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:51:09+00:00 2026-05-30T11:51:09+00:00

I am writing a web app that will use HTML to display a form.

  • 0

I am writing a web app that will use HTML to display a form. Then the user completes the form, and on submit the form is sent to PHP. In the PHP file I have it set up to call and exec() command to a Python file that will return data. But for some reason I am not getting anything back. When I execute the command in terminal it works great, but no response we ran in the web browser.

HTML:

<form id ="nameForm" action="python.php" method="post" target="_blank">
     <label>First Name:</label><input type="text" id="firstName" name="firstName"><br>
     <label>Last Name:</label><input type="text" id="lastName" name="lastName"><br>
     <input type="submit" id="submitName" value="Submit">
</form>

PHP:

$firstName = $_REQUEST['firstName'];
$lastName = $_REQUEST['lastName'];

exec("/opt/http/PythonWeb/web/python pythonName.py " . $firstName . " " . $lastName, $response);

echo $response;

Python:

import sys

def main():
    firstName = sys.argv[1]
    lastName = sys.argv[2]

    output = ""

    output += "<html>\n"
    output += "  <head><title></title></head>\n"
    output += "  <body>\n"
    output += "      <p>Hi " + firstName + " " + lastName + "</p>\n"
    output += "  </body>\n"
    output += "</html>\n"

    print output

if __name__ == '__main__': main()

Please give me some suggestions as to what may be wrong. I am new to Python, but it’s what the boss man wants… so I am going to make this work. Thanks!

  • 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-05-30T11:51:10+00:00Added an answer on May 30, 2026 at 11:51 am

    According to this http://www.php.net/manual/en/function.passthru.php, you’re using passthrough in a wrong way. It is for binary data…

    This function should be used in place of exec() or system() when the
    output from the Unix command is binary data which needs to be passed
    directly back to the browser.

    Try Exec().

    Hope I was helpful.

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

Sidebar

Related Questions

I'm writing a web app that will use twitter as its primary log on
I am being tasked with writing an asp.net web app that will use ADFS
I'm writing a simple web app in PHP that needs to have write access
I am writing a web app which will allow the user to specify a
I'm writing a web-app for the iPad that will be loading data from a
I'm writing a small web app that will receive and parse tab-delimited text files
Imagine you're writing a web app that will have 1 million users (they all
I'm writing a web app that needs to use several ansi C functions to
I'm writing a web app that supports multiple users. Each user has their own
I am writing a Web app that will need to run a background process

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.