Link to home
Start Free TrialLog in
Avatar of jat0369
jat0369

asked on

PHP to Powershell Execution

Hello everyone. I'm having some troubles figuring out how to wrap my head around this project I'm working on. I want to have a webpage function as my script's gui.

Basically I want to have a simple PHP form that will pass the text box values to powershell variables.


Name :________
Email: _________

Write-Host $Name
Write-Host $Email

How would I go about doing that? I'm a novice to both PHP and powershell.
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

On the PHP side of things, this article can point you to some good learning resources.
https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11769-And-by-the-way-I-am-new-to-PHP.html

PHP has an introductory tutorial on dealing with HTML forms.  When you read it, follow the links for more details about how to work with forms safely.
http://php.net/manual/en/tutorial.forms.php

I'll leave the PowerShell part to another expert.
ASKER CERTIFIED SOLUTION
Avatar of Giovanni
Giovanni
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just a thought... If you're new to PHP, try to explain in writing (one sentence is all you need) what each line of code in the accepted solution is doing.  If you find that you can't do that, you might want to take some time to look up the functions, learn about regular expressions, etc.  If you're in an area of PHP programming where exec() seems like the answer, you're almost always asking the wrong question.  It's a place where many risks lie, and many hosting companies disable exec() for that reason.