Jump to content

Run php in a table cell


phpsupernoob4

Recommended Posts

Hi, I am essentially trying to add a welcome/logon part to my site. So as you can see the idea of this script is to welcome the customer, get them to sign in or register, however I would like when the person clicks on "Log in" for my login script to appear in this cell (so they dont leave the page), yet I am at a loss for how to do it!! Help please

 

session_start();

if($_SESSION['username'])

echo "Welcome $firstname";

else

echo

'<html>Welcome!

<a href="/login.php">Log in</a>

<br>

Not an existing customer? <a href="/register.php">Sign up</a>

</html>';

Link to comment
Share on other sites

If I hide with CSS it will take up extra space as it would be text + form?

Could someone provide code here and possibly explain, as I said I am new to this, I am attempting to learn javascript but I still have no idea how to make the text the variable to either load or unhide the form....

Link to comment
Share on other sites

Oh, you want to simply toggle visibility of a cell?

I was under the impression that you wanted to inject a page onclick.

My mistake. Disregard my post.

If you want the element hidden without it taking up it designated space, use display: none;

Link to comment
Share on other sites

No I think your original answer was closer to what I wanted to do, I want the cell to have its current content removed and replaced with the load, I am still trying to get to grips with the link you sent but it is a bit above me.

 

So far to make the words login I found the idea of

 

<a href="javascript:;" onclick="document.FORM NAME.load();">Login</a>

 

so then I can run the load script, to remove the current contents and replace it with the login.php form. How that code would look I have no idea yet, or how it is done

Link to comment
Share on other sites

Then you really have two options, you can integrate the login.php script into the page that you want to call it from, and simply toggle its visibility onclick (I think xyph was after this solution).

Or you can use jquery and the .load() function (using the links I provided) to load the script into a specified element onclick.

To use jquery you will need to have the library on your server or link to an external repository (google and several others host the lib).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.