Jump to content

Forms not working, assuming config problem


Nik Is Legend

Recommended Posts

I'm relatively new to php and I've been having some problems trying to make a simple form. When submitted it takes me to form.php, but it doesn't look like its being processed by the server. It prints out the code, instead of the processed information. I've included both files I'm working with and my phpinfo().

 

Thanks.

 

order.html

<html><body>
<h4>Tizag Art Supply Order Form</h4>

<form action="form.php" method="post"> 
<select id="item"> 
	<option>Paint</option>
	<option>Brushes</option>
	<option>Erasers</option>
</select>

    Quantity: <input id="quantity" type="text" /> 
              <input type="submit" />

</form>
</body></html>

 

form.php

<html><body>
<?php

$quantity = $_POST['quantity'];
$item = $_POST['item'];

echo "You ordered ". $quantity . " " . $item . ".<br />";
echo "Thank you for ordering from Tizag Art Supplies!";

?>
</body></html>

 

Version Apache/2.0.59 (Unix) PHP/5.2.6 DAV/2

 

allow_call_time_pass_reference On On

allow_url_fopen On On

allow_url_include Off Off

always_populate_raw_post_data Off Off

arg_separator.input & &

arg_separator.output & &

asp_tags Off Off

auto_append_file no value no value

auto_globals_jit On On

auto_prepend_file no value no value

browscap no value no value

default_charset no value no value

default_mimetype text/html text/html

define_syslog_variables Off Off

disable_classes no value no value

disable_functions no value no value

display_errors Off Off

display_startup_errors Off Off

doc_root no value no value

docref_ext no value no value

docref_root no value no value

enable_dl On On

error_append_string no value no value

error_log /Applications/MAMP/logs/php_error.log /Applications/MAMP/logs/php_error.log

error_prepend_string no value no value

error_reporting 6143 6143

expose_php On On

extension_dir /Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20050922/ /Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20050922/

file_uploads On On

highlight.bg #FFFFFF #FFFFFF

highlight.comment #FF8000 #FF8000

highlight.default #0000BB #0000BB

highlight.html #000000 #000000

highlight.keyword #007700 #007700

highlight.string #DD0000 #DD0000

html_errors On On

ignore_repeated_errors Off Off

ignore_repeated_source Off Off

ignore_user_abort Off Off

implicit_flush Off Off

include_path .:/Applications/MAMP/bin/php5/lib/php .:/Applications/MAMP/bin/php5/lib/php

log_errors On On

log_errors_max_len 1024 1024

magic_quotes_gpc On On

magic_quotes_runtime Off Off

magic_quotes_sybase Off Off

mail.force_extra_parameters no value no value

max_execution_time 30 30

max_input_nesting_level 64 64

max_input_time 60 60

memory_limit 8M 8M

open_basedir no value no value

output_buffering no value no value

output_handler no value no value

post_max_size 32M 32M

precision 12 12

realpath_cache_size 16K 16K

realpath_cache_ttl 120 120

register_argc_argv On On

register_globals On On

register_long_arrays On On

report_memleaks On On

report_zend_debug On On

safe_mode Off Off

safe_mode_exec_dir no value no value

safe_mode_gid Off Off

safe_mode_include_dir no value no value

sendmail_from no value no value

sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i

serialize_precision 100 100

short_open_tag On On

SMTP localhost localhost

smtp_port 25 25

sql.safe_mode Off Off

track_errors Off Off

unserialize_callback_func no value no value

upload_max_filesize 32M 32M

upload_tmp_dir /Applications/MAMP/tmp/php /Applications/MAMP/tmp/php

user_dir no value no value

variables_order EGPCS EGPCS

xmlrpc_error_number 0 0

xmlrpc_errors Off Off

y2k_compliance On On

zend.ze1_compatibility_mode Off Off

You need to put a name attribute in each form tag. The values of the names populate the $_POST array:

<html><body>
<h4>Tizag Art Supply Order Form</h4>

<form action="form.php" method="post"> 
<select id="item" name="item"> 
	<option>Paint</option>
	<option>Brushes</option>
	<option>Erasers</option>
</select>

    Quantity: <input id="quantity" name="quantity" type="text" /> 
              <input type="submit" name="submit" />

</form>
</body></html>

 

Ken

 

 

Ya should look something like this

 

<form action="form.php" method="post">
   <select id="item" name="item">
      <option value='pain'>Paint</option>
      <option value='brushes'>Brushes</option>
      <option value='erasers'>Erasers</option>
   </select>

 

 

That about all the missing I think your textarea has a name set to it so it's ok

 

Cheers!

Stephen

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.