Jump to content

Reload Page.


Go to solution Solved by ginerjm,

Recommended Posts

I have a form which when submitted should display the updates on the page however it doesn't. The data uploads into the database gracefully however it does not show on the page until it is refreshed. I would like to know how to refresh the page after form has been submitted. I tried header but I get an error. Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/total/new_car.php:22) in /Applications/MAMP/htdocs/total/new_car.php on line 34 and I have the header set above any html output so that lost me.

 

 

I added relavant files here

existingcustomers.php

new_car.php

Link to comment
https://forums.phpfreaks.com/topic/279126-reload-page/
Share on other sites

  • Solution

As for the error message, you probably have a stray space character or blank line in your script and that is the data that is being sent.  Actually it tells you what line to look for, so see what's there.

 

As for your question - Let me see if I have this straight.  Your user puts info on the page and hits submit.  You do you updates.  Now - what "updates" do you want to see on the page after the db has been updated?   Anything that the user didn't input you would obviously have to send back to the page (along with the previous input vals of course) so yes - you have to refresh the page in a sense.   Are you doing this update via ajax/js or thru an actual submit button calling a php script? 

Link to comment
https://forums.phpfreaks.com/topic/279126-reload-page/#findComment-1435806
Share on other sites

anything that the user didn't input just doesn't upload to the database I require year, make, and model before i insert into the database. The problem is once data has been uploaded it does not dynamically display on page. That is why I need to reload page. However I try to be as vigilant  as possible since im a newbie and I cannot see where in the line I am getting error for. Is there anyway for me to reload the page without using the header function

Link to comment
https://forums.phpfreaks.com/topic/279126-reload-page/#findComment-1435809
Share on other sites

I don't know what you are talking about.

 

The usual process is:

 

script builds page and sends blank input fields in a form

 

user fills in form and hits submit

 

script reads the input vars from POST and validates them, cleans them and does a query to post the db (basically).  Then script either sends back an empty page again for the user, or sends back a new page with different info on it based on what the user did on the first screen. 

 

Not sure what you are trying to say here:

 

"The problem is once data has been uploaded it does not dynamically display on page"

 

Of course it doesn't dynamically display - you have to send it, whatever it is.

Link to comment
https://forums.phpfreaks.com/topic/279126-reload-page/#findComment-1435812
Share on other sites

Ok let me see if I can make this a little clearer

 

I have a form which when submitted is uploaded into my DB

I have a loop script in my existingcustomers.php file which displays all data within the table where the information has been upload

when I input information in the form and it is uploaded into the database the page reloads--RIGHT

the loop is performed but does not return the data that was just uploaded----

it is when you refresh the page once more that the information that was submitted through the form is displayed on the page..

 

Sorry if I cannot make this any clearer

Link to comment
https://forums.phpfreaks.com/topic/279126-reload-page/#findComment-1435814
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.