Note that there are some explanatory texts on larger screens.

plurals
  1. POTesting a PHP script on a local computer
    primarykey
    data
    text
    <p>New to PHP and web development in general. I am trying to get information from an HTML form to appear in a table on another web page after clicking submit. So I installed Apache and then PHP on my local PC and expected to be able to test a PHP script locally however it does not return the information I was expecting. The following is the code for the form:</p> <pre><code>&lt;form method="post" action="showform.php"&gt; Please fill out the following form if you would like to be contacted: &lt;br/&gt; Name:&lt;input type="text" name="name" /&gt; &lt;br/&gt;&lt;br/&gt; Company: &lt;input type="text" name="company"/&gt; &lt;br/&gt;&lt;br/&gt; Phone: &lt;input type="text" name="phone" /&gt; &lt;br/&gt;&lt;br/&gt; Email: &lt;input type="text" name="email" /&gt; &lt;br/&gt;&lt;br/&gt; &lt;input type="submit" name="Submit" value="Submit" /&gt; &lt;/form&gt; </code></pre> <p>The following is the code for the php script:</p> <pre><code>&lt;table&gt; &lt;tr&gt;&lt;th&gt;Field Name&lt;/th&gt;&lt;th&gt;Value(s)&lt;/th&gt;&lt;/tr&gt; &lt;?php if (empty($_POST)) { print "&lt;p&gt;No data was submitted.&lt;/p&gt;"; } else { foreach ($_POST as $key =&gt; $value) { if (get_magic_quotes_gpc()) $value=stripslashes($value); if ($key=='extras') { if (is_array($_POST['extras']) ){ print "&lt;tr&gt;&lt;td&gt;&lt;code&gt;$key&lt;/code&gt;&lt;/td&gt;&lt;td&gt;"; foreach ($_POST['extras'] as $value) { print "&lt;i&gt;$value&lt;/i&gt;&lt;br /&gt;"; } print "&lt;/td&gt;&lt;/tr&gt;"; } else { print "&lt;tr&gt;&lt;td&gt;&lt;code&gt;$key&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;i&gt;$value&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;\n"; } } else { print "&lt;tr&gt;&lt;td&gt;&lt;code&gt;$key&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;i&gt;$value&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;\n"; } } } ?&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I know it works when used on the internet but how come it doesn't work locally. I have checked that apache and php are installed correctly. What could be the issue? The current result is a table with $key and $value in the places where the correct values should be, in other words in the table cells. Thanks for your help.</p> <p>UPDATE: Now working though WAMPSERVER- thanks to all who helped!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload