simeonC Posted June 13, 2013 Share Posted June 13, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/279126-reload-page/ Share on other sites More sharing options...
Solution ginerjm Posted June 13, 2013 Solution Share Posted June 13, 2013 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? Quote Link to comment https://forums.phpfreaks.com/topic/279126-reload-page/#findComment-1435806 Share on other sites More sharing options...
simeonC Posted June 13, 2013 Author Share Posted June 13, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/279126-reload-page/#findComment-1435809 Share on other sites More sharing options...
ginerjm Posted June 13, 2013 Share Posted June 13, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/279126-reload-page/#findComment-1435812 Share on other sites More sharing options...
simeonC Posted June 13, 2013 Author Share Posted June 13, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/279126-reload-page/#findComment-1435814 Share on other sites More sharing options...
simeonC Posted June 13, 2013 Author Share Posted June 13, 2013 Got it thank you for your help. Quote Link to comment https://forums.phpfreaks.com/topic/279126-reload-page/#findComment-1435816 Share on other sites More sharing options...
ginerjm Posted June 13, 2013 Share Posted June 13, 2013 HTH. I'm still confused by your last posts, but you marked this answered, so my work here is done. Quote Link to comment https://forums.phpfreaks.com/topic/279126-reload-page/#findComment-1435823 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.