Jump to content

Newbie with a question


surreylee

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
https://forums.phpfreaks.com/topic/286072-newbie-with-a-question/
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.

  On 2/9/2014 at 9:27 PM, Pain said:

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!!!

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.