Interfacing in PHP: Urgent help needed!
Moderator: General Moderators
-
siminder82
- Forum Newbie
- Posts: 6
- Joined: Thu Jul 10, 2008 8:48 pm
Interfacing in PHP: Urgent help needed!
Hello everyone.
Im having some trouble with interfacing in PHP. Here's what I need to implement:
I have a php file called main.php which does some processing. It takes input from a html file test.html and prints the output after the processing is over. Now, I need to break away from a point in main.php (on certain condition) and goto another php file file2.php passing some parameters. Now file2.php has an HTML form embedded in it and I need to ask user input using that form (through submit button), take the user input value and go back to the main.php with that value, to carry on the rest of the processing of main.php.
I have tried multiple things but none seems to work. Can anyone please help me and suggest what should I do?
Im having some trouble with interfacing in PHP. Here's what I need to implement:
I have a php file called main.php which does some processing. It takes input from a html file test.html and prints the output after the processing is over. Now, I need to break away from a point in main.php (on certain condition) and goto another php file file2.php passing some parameters. Now file2.php has an HTML form embedded in it and I need to ask user input using that form (through submit button), take the user input value and go back to the main.php with that value, to carry on the rest of the processing of main.php.
I have tried multiple things but none seems to work. Can anyone please help me and suggest what should I do?
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: Interfacing in PHP: Urgent help needed!
Use sessions.
This will keep your data from page to page.
This will keep your data from page to page.
Re: Interfacing in PHP: Urgent help needed!
find a small abandoned CMS and modify to suit your needs.
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: Interfacing in PHP: Urgent help needed!
That might be a bit overkill. No point trying to use a rocket to kill a flyphp_east wrote:find a small abandoned CMS and modify to suit your needs.
Re: Interfacing in PHP: Urgent help needed!
yes of course, but i wasn't on about using a jack hammer to kill a mosquito. i was talking about this http://snewscms.com/
-
siminder82
- Forum Newbie
- Posts: 6
- Joined: Thu Jul 10, 2008 8:48 pm
Re: Interfacing in PHP: Urgent help needed!
I can use session variables for passing values but here's the concern ive been struggling with
Once I submit the form in file2.php, how do I go back to the main.php page at the point where I broke off.
I tried using include_once and also header("location:file2.php") to break from main.php but nothing seems to work.
Is there another way I can do it or is it not possible?
Once I submit the form in file2.php, how do I go back to the main.php page at the point where I broke off.
I tried using include_once and also header("location:file2.php") to break from main.php but nothing seems to work.
Is there another way I can do it or is it not possible?
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: Interfacing in PHP: Urgent help needed!
Not entirely sure what you mean, but you could always use ajax, that way you never leave the page.
Re: Interfacing in PHP: Urgent help needed!
since you have a form where the user needs to fill in, in file2, that form action should be set to main.php.siminder82 wrote:I can use session variables for passing values but here's the concern ive been struggling with
Once I submit the form in file2.php, how do I go back to the main.php page at the point where I broke off.
I tried using include_once and also header("location:file2.php") to break from main.php but nothing seems to work.
Is there another way I can do it or is it not possible?
in main.php you should now test if there is a non empty form value.
for example, if you have a field
Code: Select all
<input type="text" id="my_user_input" value="" />Code: Select all
if (empty($_POST['my_user_input']))
{
//proceed with processing part 1
}
else
{
//proceed with further processing
}