How to submit form without page reloading?

0 votes

I have a classifieds website, and on the page where ads are showed, I am creating a "Send a tip to a friend" form.

So anybody who wants can send a tip of the ad to some friends email-adress.

I am guessing the form must be submitted to a php page right?

<form name='tip' method='post' action='tip.php'>
Tip somebody: <input name="tip_email" type="text" size="30" onfocus="tip_div(1);" onblur="tip_div(2);"/>
 <input type="submit" value="Skicka Tips"/>
 <input type="hidden" name="ad_id" />
 </form>

When submitting the form, the page gets reloaded.I don't want that

Is there any way to make it not reload and still send the mail? 

Oct 6 in PHP by kartik
• 36,020 points
77 views

1 answer to this question.

0 votes

Hello @kartik,

If you put an Iframe in the page, you can redirect the exit of the action there and make it show up. You can do nothing, of course. In that case, you can set the iframe display to none.

<iframe name="votar" style="display:none;"></iframe>
<form action="tip.php" method="post" target="votar">
    <input type="submit" value="Skicka Tips">
    <input type="hidden" name="ad_id" value="2">            
</form>

Hope it helps!!
Thank you!!

answered Oct 6 by Niroj
• 78,480 points

Related Questions In PHP

0 votes
1 answer

How to validate E-mail and URL of Php form?

hey, The code below shows a simple way ...READ MORE

answered Feb 13 in PHP by manish
257 views
0 votes
1 answer

How can I add PHP page to WordPress?

Hii @kartik, First, duplicate post.php or page.php in your theme folder. Rename the ...READ MORE

answered May 8 in PHP by Niroj
• 78,480 points
204 views
0 votes
1 answer

How to get Redux Form data in another Component?

Hello @kartik, What you need to do is ...READ MORE

answered Jun 1 in PHP by Niroj
• 78,480 points
713 views
0 votes
1 answer

How to cache fetched data in react without redux?

Hello @kartik, The best way to save data ...READ MORE

answered Jun 1 in PHP by Niroj
• 78,480 points
210 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18 in Laravel by Niroj
• 78,480 points
3,528 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18 in Laravel by Niroj
• 78,480 points
421 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23 in Laravel by Niroj
• 78,480 points
292 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23 in Laravel by Niroj
• 78,480 points
4,230 views
0 votes
1 answer

How to Validate Form Data With PHP?

Hey @kartik, The first thing we will do ...READ MORE

answered Feb 13 in PHP by Niroj
• 78,480 points
283 views
0 votes
1 answer

How to query all the GraphQL type fields without writing a long query?

Hello @kartik, GraphQL query format was designed in order ...READ MORE

answered Apr 20 in PHP by Niroj
• 78,480 points
177 views