Jump to content

Newbie with a question


surreylee
Go to solution Solved by Pain,

Recommended Posts

Hi guys. I am a newbie to working with PHP and I am trying to figure out its capability when developing websites. But, is it possible to accept a user's input and use their response to send them to a specific URL? Or is it possible to use their input and allow them to download a specific file or view at a specific file/document?

Link to comment
Share on other sites

  • Solution

Hi.

 

Well since you are a beginner I recommend doing this.

 

Retrieve info from the database. Lets say 'id'. Then your first line of the form should be something like this:

<form name="form1" action="profile.php?id=<?php echo $id; ?>" method="POST"  />

Then in your profile.php get that id from the URL by doing this:

$id = $_GET['id'];

Now you can use 'id' in WHERE clause and retrieve info from the database (that belongs to this id).

 

 

Note: this is a bad practice, you should not use this in the future, however this might help you understand a bit more PHP.

Edited by Pain
Link to comment
Share on other sites

Hi.

 

Well since you are a beginner I recommend doing this.

 

Retrieve info from the database. Lets say 'id'. Then your first line of the form should be something like this:

<form name="form1" action="profile.php?id=<?php echo $id; ?>" method="POST"  />

Then in your profile.php get that id from the URL by doing this:

$id = $_GET['id'];

Now you can use 'id' in WHERE clause and retrieve info from the database (that belongs to this id).

 

 

Note: this is a bad practice, you should not use this in the future, however this might help you understand a bit more PHP.

 

Thanks Pain, that defintely gives me a better idea and understanding of what I can do. Thanks!!!

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.