11-29-2014, 01:48 PM
I'm having a bit of trouble with form_submit(). Here's my issue: i have 2 php files. My controller is called email.php and my view is called newsletter.php (if anyone has seen Code Igniter from Scratch Day 4, this is that tutorial)..
I have created a form for the user to enter their Name, Email Address, and then to press Submit in my newsletter.php file, which should take them to the function send() in my email.php file. When the user clicks Submit, I get a 404 Page Not Found error. I've copied the code for my newsletter.php file below:
<html lang='en'>
<head>
<title>untitled</title>
<style type = 'text/css'>
label {display:black;}
</style>
</head>
<body>
<div id="newsletter_form">
<?php echo form_open('email/send'); ?>
<?php
$name_data = array(
'name' => 'name',
'id' => 'name',
'value' => set_value('name')
);
?>
<p><label for="name">Name: </label><?php echo form_input($name_data); ?></p>
<p>
<label for="name">Email Address: </label>
<input type = 'text' name = 'email' id = 'email' value = '<?php echo set_value('email'); ?>'>
</p>
<p>
<?php echo form_submit('submit', 'Submit'); ?>
</p>
<?php echo form_close(); ?>
<?php echo validation_errors(); ?>
</div><!--end newsletter-form-->
</body>
</html>
Any ideas?
I have created a form for the user to enter their Name, Email Address, and then to press Submit in my newsletter.php file, which should take them to the function send() in my email.php file. When the user clicks Submit, I get a 404 Page Not Found error. I've copied the code for my newsletter.php file below:
<html lang='en'>
<head>
<title>untitled</title>
<style type = 'text/css'>
label {display:black;}
</style>
</head>
<body>
<div id="newsletter_form">
<?php echo form_open('email/send'); ?>
<?php
$name_data = array(
'name' => 'name',
'id' => 'name',
'value' => set_value('name')
);
?>
<p><label for="name">Name: </label><?php echo form_input($name_data); ?></p>
<p>
<label for="name">Email Address: </label>
<input type = 'text' name = 'email' id = 'email' value = '<?php echo set_value('email'); ?>'>
</p>
<p>
<?php echo form_submit('submit', 'Submit'); ?>
</p>
<?php echo form_close(); ?>
<?php echo validation_errors(); ?>
</div><!--end newsletter-form-->
</body>
</html>
Any ideas?