Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PHP/HTML Help

Options
  • 30-12-2009 12:34am
    #1
    Closed Accounts Posts: 112 ✭✭


    Hi,
    I'm Aran from Gahim, we are a free website builder under construction for the BT Young Scientist, unfortunatly we have come a accross an error which we just can't get our head around, when you visit http://beta.gahim.com there is a form there, that form is suppost to 'throw' that information to http://beta.gahim.com/start. When someone enters there email and password and clicks continue we use the <? echo $_POST; ?> in the value of the email field so what they have entered in the previous form goes onto this. Unfortunatly it just doesn't work, we have tried everything the ID is perfect, the pages are in php and we have even contacted our web host about it and they can't find the problem, could someone please help us? Thanks!


«13

Comments

  • Closed Accounts Posts: 1,200 ✭✭✭louie


    first try to print the POST array
    [php]
    print_r($_POST);
    [/php]

    to make sure your page is receiving the posted data.
    second, change the form enctype='text/plain' to enctype="multipart/form-data"


  • Closed Accounts Posts: 112 ✭✭gahim


    Hi, thanks for your reply I have done everything you have said and have got help from a couple of people but it still doesn't work.
    :confused:


  • Closed Accounts Posts: 1,200 ✭✭✭louie


    You probably have a redirect somwhere

    try this and note the comments
    [php]
    <?php
    /*
    ADD THE PHP CODE AT THE VERY TOP OF THE PAGE

    SET THE FORM TO SUBMIT TO ITSELF - http://beta.gahim.com/ - NOTE THE BETA IN THE URL AS A SUBDOMAIN

    GET THE POST, SET SESSION, AND REDIRECT TO THE LOGIN PAGE
    */
    if(count($_POST)>0){
    $username = $_POST;
    $passwordlogin = $_POST;
    //SET SESSIONS AND REDIRECT
    $_SESSION = $username;
    $_SESSION = $passwordlogin;
    //NOW REDIRECT
    header("Location: YOUR URL HERE TO REDIRECT TO", true, 301);
    exit();
    //ON THE OTHER PAGE LOOK FOR SESSION INSTEAD OF POST
    //ALSO MAKE SURE SESSIONS CAN BE RED ON THE ENTIRE DOMAIN
    }
    ?>
    <form name="Login" method="POST" action="http://beta.gahim.com/&quot; enctype="text/plain" id="Form3">
    <input type="password" id="Editbox3" style="position:absolute;left:276px;top:10px;width:156px;font-family:Arial;font-size:9.3px;z-index:4" size="39" name="passwordlogin" value="">
    <input type="text" id="Editbox4" style="position:absolute;left:65px;top:11px;width:148px;font-family:Arial;font-size:9.3px;z-index:5" size="37" name="username" value="">
    <div id="bv_Text4" style="position:absolute;left:15px;top:14px;width:51px;height:12px;z-index:6" align="left">
    <font style="font-size:9.3px" color="#000000" face="Arial">Username:</font></div>
    <div id="bv_Text3" style="position:absolute;left:231px;top:14px;width:51px;height:12px;z-index:7" align="left">
    <font style="font-size:9.3px" color="#000000" face="Arial">Password:</font></div>
    <input type="submit" id="Button1" name="Login" value="Login" style="position:absolute;left:441px;top:7px;width:45px;height:24px;z-index:8">

    </form>
    [/php]


  • Closed Accounts Posts: 112 ✭✭gahim


    Hi,
    Thanks for your reply

    there are two forms on the page, one is the login form (not done yet) and the other one is the signup form where it throws information to the next page, the code you gave me was for the login form but I don't need anything for the login form.

    Thanks, please send me the code for the signup form, thanks...


  • Closed Accounts Posts: 112 ✭✭gahim


    Hi

    so

    <?php
    /*
    */
    if(count($_POST)>0){
    $email = $_POST;
    $password = $_POST;
    //SET SESSIONS AND REDIRECT
    $_SESSION = $email;
    $_SESSION = $password;
    //NOW REDIRECT
    header("Location:http://beta.gahim.com/start", true, 301);
    exit();
    }
    ?>

    I should put on beta.gahim.com on the top of the page (above title tags etc..) and set the signup form to itself, correct?


  • Advertisement
  • Closed Accounts Posts: 112 ✭✭gahim


    gahim wrote: »
    Hi

    so

    <?php
    /*
    */
    if(count($_POST)>0){
    $email = $_POST;
    $password = $_POST;
    //SET SESSIONS AND REDIRECT
    $_SESSION = $email;
    $_SESSION = $password;
    //NOW REDIRECT
    header("Location:http://beta.gahim.com/start", true, 301);
    exit();
    }
    ?>

    I should put on beta.gahim.com on the top of the page (above title tags etc..) and set the signup form to itself, correct?

    So I have done that, when I click continue it does nothing but refresh the page and clear the fields...
    :confused:


  • Closed Accounts Posts: 1,200 ✭✭✭louie


    What I gave you is for the second form with the "CONTINUE" button.
    You have changed the fields names in the $_POST code to look for the fields from the first form. WHY?

    I don't know if you can understand what's going on as the form action is not set to post data to itself but another page so how do you expect to get the posted fields?


  • Closed Accounts Posts: 112 ✭✭gahim


    Ok sorry, so I will paste the EXACT code you sent me on the top page, the page that recieves the data is beta.gahim.com/start or gahim.com/beta/start...


  • Closed Accounts Posts: 112 ✭✭gahim


    Still doesn't work


  • Closed Accounts Posts: 112 ✭✭gahim


    You see, the code you sent me was to do with the login form as I can see, because everything refers to the login, the signup form with the continue button is different...


  • Advertisement
  • Closed Accounts Posts: 270 ✭✭CoNfOuNd


    I think you are really over-complicating things and you need to just cut it back to the basic code. Something is interfering with your basic PHP $_POST.

    Create a file called test1.php with:
    [PHP]<form name="test" method="POST" action="test2.php">
    <input type="text" size="20" name="email">
    <input type="submit" name="submit" value="submit">
    </form>
    [/PHP]

    and another file test2.php with:
    [PHP]<? echo $_POST; ?>[/PHP]

    The code is really that simple, and it works!

    Then add the other code to the test pages and you'll figure out where you've gone wrong. Trial and error. It could be the Javascript.


  • Closed Accounts Posts: 112 ✭✭gahim


    Hi,
    I know it works but for some reason it doesn't work on this form...

    There is something wrong, can I pay somebody to fix it?


  • Closed Accounts Posts: 270 ✭✭CoNfOuNd


    Cut it down to the bare essential code and then build it up. It's the best way..

    You'll have the satisfaction of knowing you fixed it yourself!


  • Closed Accounts Posts: 112 ✭✭gahim


    On the homepage the form code is
    <form name="Start" method="POST" action="http://beta.gahim.com/start"&gt;
    <input type="text" id="email" style="position:absolute;left:124px;top:13px;width:224px;font-family:Arial;font-size:16px;z-index:1" size="32" value="">
    <input type="password" id="password" style="position:absolute;left:124px;top:50px;width:224px;font-family:Arial;font-size:16px;z-index:2" size="32" value="">
    <input type="image" id="Submit" name="Submit" src="continuehome.png" style="position:absolute;left:125px;top:85px;width:223px;height:59px;z-index:3">
    </form>

    And on the second page
    <form name="signup" method="POST" action="http://beta.gahim.com/signup&quot; enctype="multipart/form-data" id="Form1" onsubmit="return Validatesignup(this)">
    <input type="text" id="Editbox1" style="position:absolute;left:6px;top:155px;width:222px;font-family:Arial;font-size:13px;z-index:0" size="37" name="title" value="">
    <input type="text" style="position:absolute;left:6px;top:123px;width:222px;font-family:Arial;font-size:13px;z-index:1" size="37" name="site" value="">
    <input type="password" style="position:absolute;left:6px;top:93px;width:222px;font-family:Arial;font-size:13px;z-index:2" size="37" name="password" value="<? echo $_POST; ?>">
    <input type="text" style="position:absolute;left:6px;top:62px;width:222px;font-family:Arial;font-size:13px;z-index:3" size="37" name="email" value="<? echo $_POST; ?>">
    <input type="text" style="position:absolute;left:6px;top:31px;width:222px;font-family:Arial;font-size:13px;z-index:4" size="37" name="name" value="">
    <input type="password" style="position:absolute;left:353px;top:92px;width:222px;font-family:Arial;font-size:13px;z-index:5" size="37" name="passwordconfirm" value="">
    <div id="bv_Text5" style="position:absolute;left:237px;top:96px;width:121px;height:16px;z-index:6" align="left">
    <font style="font-size:13px" color="#000000" face="Arial">Confirm Password:</font></div>
    <div id="bv_Text6" style="position:absolute;left:231px;top:130px;width:121px;height:16px;z-index:7" align="left">
    <font style="font-size:13px" color="#000000" face="Arial">.gahim.com</font></div>
    <div id="bv_Text7" style="position:absolute;left:317px;top:131px;width:302px;height:15px;z-index:8" align="left">
    <font style="font-size:12px" color="#282828" face="Arial">Hint: This is what people type in to go to your website</font></div>
    <input type="checkbox" id="Checkbox1"" name="agree" value="" checked style="position:absolute;left:6px;top:188px;z-index:9">
    <div id="bv_Text8" style="position:absolute;left:24px;top:189px;width:190px;height:16px;z-index:10" align="left">
    <font style="font-size:13px" color="#000000" face="Arial">I agree to the <a href="http://www.gahim.com/terms">Terms of Service</a></font></div>
    <input type="submit" id="Button1"" name="Submit" value="Ok, Create My Website" style="position:absolute;left:11px;top:220px;width:190px;height:24px;z-index:11">

    </form>


  • Closed Accounts Posts: 1,200 ✭✭✭louie


    Did you check your LOG FILES?
    I have a feeling there is some sort of redirection there which makes you loose the POST data.


  • Closed Accounts Posts: 112 ✭✭gahim


    I am completely lost, everything in the code I need


  • Closed Accounts Posts: 112 ✭✭gahim


    louie wrote: »
    Did you check your LOG FILES?
    I have a feeling there is some sort of redirection there which makes you loose the POST data.

    I don't think I have any log files, where do I find them?


  • Registered Users Posts: 339 ✭✭spoonface


    I took your form and changed its action to point to my server and changed it to GET so I could see your vars in the access log. Here's what I got:

    GET /start?Submit.x=0&Submit.y=0

    The same occurred using POST. So the error is at the most basic level (in your html, not in your receiving PHP) i.e. the actual form doesn't correctly submit its variables. Maybe you should build your form up from scratch to be sure of what's going on.

    Also, add this to your PHP code (even with nothing else in your page initially to see what's coming in - it will be displayed onscrceen.

    $form_fields = array_keys($HTTP_POST_VARS);
    print "######################################################################<p>POST:<br><br>\n";
    for ($i = 0; $i < sizeof($form_fields); $i++) {

    $thisField = $form_fields[$i];
    $thisValue = $HTTP_POST_VARS[$thisField];
    print "<br>$thisField = $thisValue<br>\n";
    };

    print "<p>GET:<br><br>\n";
    $form_fields2 = array_keys($HTTP_GET_VARS);
    for ($i = 0; $i < sizeof($form_fields2); $i++) {

    $thisField = $form_fields2[$i];
    $thisValue = $HTTP_GET_VARS[$thisField];
    print "<br>$thisField = $thisValue<br>\n";
    };
    print "<p>######################################################################<p>\n";



    Hope this helps.


  • Closed Accounts Posts: 112 ✭✭gahim


    Hi Thanks for your reply unfortunatly I have no idea where to put that php code since I am very new to creating websites in addition I built this form on a web builder and checked the whole code and everything is perfect, I contacted someone from SpiralHost and they agreed everything seems good... I can't create it from scratch as I need certain exact positions which I cannot code myself...

    :confused:

    Thanks for all your help and I'm sure we can get to the bottom of this...


  • Closed Accounts Posts: 1,200 ✭✭✭louie


    A form has to be posted directly to the receving page otherwise you loose all the posted data. Also try using a basic submit button not an image as you need to rule everything out before starting from scratch...


  • Advertisement
  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    The address http://beta.gahim.com/signup is broken

    The page http://beta.gahim.com/start seems to be another form; while it's possible that the PHP defaults to displaying the form if it receives no $_POST variables, I somehow doubt it....

    Have you tried the bare form code ?
    And which browsers have you tested it on ?


  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    P.S. Are you developing the "free website builder" too ?

    If so, lose the "position:absolute" asap, and also bear in mind that "drag and drop as per Microsoft Word" is not desirable on the web since most people without the required knowledge will create layouts that work on their screen, browser, and resolution only and this will result in crap-looking, unusable websites; I already have to scroll horizontally on a Netbook to see your form and navigation, and that's a complete no-no.


  • Registered Users Posts: 339 ✭✭spoonface


    gahim wrote: »
    Hi Thanks for your reply unfortunatly I have no idea where to put that php code since I am very new to creating websites in addition I built this form on a web builder and checked the whole code and everything is perfect, I contacted someone from SpiralHost and they agreed everything seems good... I can't create it from scratch as I need certain exact positions which I cannot code myself...

    :confused:

    Thanks for all your help and I'm sure we can get to the bottom of this...

    From what you've said, it sounds like you're trying to use PHP but without knowing anything about it. I suggest reading at least some of Programming PHP in the O'Reilly Series to get started. Otherwise even if we manage to solve this issue for you, you won't get past the next stumbling block without knowledge of how to program PHP.

    Also, your initial description isn't very clear, which makes it hard for us to suggest solutions. Maybe try rewording it / thinking through what you've got going on.


  • Closed Accounts Posts: 112 ✭✭gahim


    Hi,
    As a somebody has said, I am trying to use PHP and have done everything perfectly, I have tried all 3 web browsers and someone from my hosting company even took a look at it and yes it's a free website builder for the BT Young Scientist Exhibition in the RDS in January 12th.


  • Closed Accounts Posts: 112 ✭✭gahim


    Liam Byrne wrote: »
    The address http://beta.gahim.com/signup is broken

    The page http://beta.gahim.com/start seems to be another form; while it's possible that the PHP defaults to displaying the form if it receives no $_POST variables, I somehow doubt it....

    Have you tried the bare form code ?
    And which browsers have you tested it on ?

    beta.gahim.com/start and gahim.com/beta/start are the same page as thats how subdomains work on this host, here is no gahim.com/signup


  • Closed Accounts Posts: 112 ✭✭gahim


    The form is going straight to the page.

    No fields should be lost, could someone take a look, and people are sending me PHP codes but I don't know where to put them, I am knew to PHP and don't have much time left to get this done...

    I would appreciate if someone could provide me step-by-step instructions...

    BT Young Scientist - 12th January - Gahim


  • Registered Users Posts: 35,523 ✭✭✭✭Gordon


    gahim wrote: »
    On the homepage the form code is
    <form name="Start" method="POST" action="http://beta.gahim.com/start"&gt;
    <input type="text" id="email" style="position:absolute;left:124px;top:13px;width:224px;font-family:Arial;font-size:16px;z-index:1" size="32" value="">
    <input type="password" id="password" style="position:absolute;left:124px;top:50px;width:224px;font-family:Arial;font-size:16px;z-index:2" size="32" value="">
    <input type="image" id="Submit" name="Submit" src="continuehome.png" style="position:absolute;left:125px;top:85px;width:223px;height:59px;z-index:3">
    </form>

    And on the second page
    <form name="signup" method="POST" action="http://beta.gahim.com/signup&quot; enctype="multipart/form-data" id="Form1" onsubmit="return Validatesignup(this)">
    <input type="text" id="Editbox1" style="position:absolute;left:6px;top:155px;width:222px;font-family:Arial;font-size:13px;z-index:0" size="37" name="title" value="">
    <input type="text" style="position:absolute;left:6px;top:123px;width:222px;font-family:Arial;font-size:13px;z-index:1" size="37" name="site" value="">
    <input type="password" style="position:absolute;left:6px;top:93px;width:222px;font-family:Arial;font-size:13px;z-index:2" size="37" name="password" value="<? echo $_POST; ?>">
    <input type="text" style="position:absolute;left:6px;top:62px;width:222px;font-family:Arial;font-size:13px;z-index:3" size="37" name="email" value="<? echo $_POST; ?>">
    <input type="text" style="position:absolute;left:6px;top:31px;width:222px;font-family:Arial;font-size:13px;z-index:4" size="37" name="name" value="">
    <input type="password" style="position:absolute;left:353px;top:92px;width:222px;font-family:Arial;font-size:13px;z-index:5" size="37" name="passwordconfirm" value="">
    <div id="bv_Text5" style="position:absolute;left:237px;top:96px;width:121px;height:16px;z-index:6" align="left">
    <font style="font-size:13px" color="#000000" face="Arial">Confirm Password:</font></div>
    <div id="bv_Text6" style="position:absolute;left:231px;top:130px;width:121px;height:16px;z-index:7" align="left">
    <font style="font-size:13px" color="#000000" face="Arial">.gahim.com</font></div>
    <div id="bv_Text7" style="position:absolute;left:317px;top:131px;width:302px;height:15px;z-index:8" align="left">
    <font style="font-size:12px" color="#282828" face="Arial">Hint: This is what people type in to go to your website</font></div>
    <input type="checkbox" id="Checkbox1"" name="agree" value="" checked style="position:absolute;left:6px;top:188px;z-index:9">
    <div id="bv_Text8" style="position:absolute;left:24px;top:189px;width:190px;height:16px;z-index:10" align="left">
    <font style="font-size:13px" color="#000000" face="Arial">I agree to the <a href="http://www.gahim.com/terms">Terms of Service</a></font></div>
    <input type="submit" id="Button1"" name="Submit" value="Ok, Create My Website" style="position:absolute;left:11px;top:220px;width:190px;height:24px;z-index:11">

    </form>
    Unless I'm wrong, shouldn't
    <input type="text" id="email" style="position:absolute;left:124px;top:13px;width:224px;font-family:Arial;font-size:16px;z-index:1" size="32" value="">
    <input type="password" id="password" style="position:absolute;left:124px;top:50px;width:224px;font-family:Arial;font-size:16px;z-index:2" size="32" value="">
    
    be
    <input type="text" id="email" [b]name="email"[/b] style="position:absolute;left:124px;top:13px;width:224px;font-family:Arial;font-size:16px;z-index:1" size="32" value="">
    <input type="password" id="password" [b]name="password"[/b] style="position:absolute;left:124px;top:50px;width:224px;font-family:Arial;font-size:16px;z-index:2" size="32" value="">
    

    ?

    Also, am I right in thinking that this is a website to showcase your young scientist and technology skills? I don't mean to sound rude, and sorry if it comes across rudely, but you might want to think about getting a coder onboard that will be able to upskill you on the technology aspect if you want this project to work. Building a free website builder site can't be an easy thing, you need a coder to make this work in my opinion.


  • Closed Accounts Posts: 112 ✭✭gahim


    I have finnished the builder, I am good at code and I have done everything right in this code


  • Registered Users Posts: 35,523 ✭✭✭✭Gordon


    Cool, so it's working then?


  • Advertisement
  • Closed Accounts Posts: 112 ✭✭gahim


    Loads of people agree that there shouldn't be anything wrong and it's a simple PHP post code and should work, even on this form people can't find the problem...

    :confused:


Advertisement