Jump to content

Include file


gork4life

Recommended Posts

Can I include a class file in the same page that I use an instance of the same class with my action attribute with my form.

 

 

Here's the code

 

<?php include 'Resources/User.php';?>
<html>
    <head>
        <title></title>
        <link href="stylesheets/styles.css" rel="stylesheet" type="text/css"/>
    </head>


    <body>
        
        <form action = "Resources/testClass.php" method="post" enctype="multipart/form-data">
            <label>First Name: </label>
            <input type="text" name="fname" id="fname" size="25" maxlength="25"/>
            <label>Last Name: </label>
            <input type="text" name="lname" id="lname" size="25" maxlength="25"/>
            <label>Email: </label>
            <input type="text" name="email" id="email" size="25" maxlength="40"/>
            <label>Username: </label>
            <input type="text" name="username" id="username" size="25" maxlength="32"/>
            <label>Password: </label>
            <input type="password" name="password" id="password" size="25" maxlength="32"/>
            <label>Re-enter Password: </label>
            <input type="password" name="conf_pass" id="conf_pass" size="25" maxlength="32"/>
            <br /><br />
            <input type="submit" name="submit" id="submit" value="Register"/>
            <input type="reset" name="reset" id="reset" value="Reset"/>
        </form>

    </body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/253854-include-file/
Share on other sites

I'm sorry I didn't explain my problem fully. If I add the include I get this error.

 

Warning: include(../includes/Constants.php) [function.include]: failed to open stream: No such file or directory in /var/www/ggender/Resources/User.php on line 1

 

If I exclude the include and just live the action attribute with the instance of the same class I have no problem and it works as intended.

 

Basically what I'm trying to do is use the instance to process the form, and include the class so that I can use a property with in that class.

Link to comment
https://forums.phpfreaks.com/topic/253854-include-file/#findComment-1301492
Share on other sites

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.